Add JSDoc documentation and file headers to all source files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,16 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// The Lucia project.
|
||||
// Copyright 2024-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
// imacat.yang@dsp.im (imacat), 2023/9/23
|
||||
/**
|
||||
* @module views/AccountManagement/MyAccount My Account page for
|
||||
* viewing and editing the current user's name and password.
|
||||
*/
|
||||
|
||||
import { onMounted, computed, ref } from 'vue';
|
||||
import i18next from '@/i18n/i18n.js';
|
||||
import { useLoginStore } from '@/stores/login';
|
||||
@@ -147,18 +157,22 @@ const isPwdEditable = ref(false);
|
||||
const isPwdEyeOn = ref(false);
|
||||
const isPwdLengthValid = ref(true);
|
||||
|
||||
/** Enables the name editing input. */
|
||||
const onEditNameClick = () => {
|
||||
isNameEditable.value = true;
|
||||
};
|
||||
|
||||
/** Enables the password editing input. */
|
||||
const onResetPwdClick = () => {
|
||||
isPwdEditable.value = true;
|
||||
};
|
||||
|
||||
/** Validates that the password meets the minimum length requirement. */
|
||||
const validatePwdLength = () => {
|
||||
isPwdLengthValid.value = inputPwd.value.length >= PWD_VALID_LENGTH;
|
||||
};
|
||||
|
||||
/** Saves the edited name to the server and refreshes user data. */
|
||||
const onSaveNameClick = async() => {
|
||||
if(inputName.value.length > 0) {
|
||||
await acctMgmtStore.editAccountName(username, inputName.value);
|
||||
@@ -169,6 +183,7 @@ const onSaveNameClick = async() => {
|
||||
}
|
||||
};
|
||||
|
||||
/** Validates and saves the new password. */
|
||||
const onSavePwdClick = async() => {
|
||||
validatePwdLength();
|
||||
if (isPwdLengthValid.value) {
|
||||
@@ -180,17 +195,23 @@ const onSavePwdClick = async() => {
|
||||
}
|
||||
};
|
||||
|
||||
/** Cancels name editing and restores the original value. */
|
||||
const onCancelNameClick = () => {
|
||||
isNameEditable.value = false;
|
||||
inputName.value = name.value;
|
||||
};
|
||||
|
||||
/** Cancels password editing and clears the input. */
|
||||
const onCancelPwdClick = () => {
|
||||
isPwdEditable.value = false;
|
||||
inputPwd.value = '';
|
||||
isPwdLengthValid.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggles the password visibility eye button.
|
||||
* @param {boolean} toBeOpen - Whether to show the password.
|
||||
*/
|
||||
const togglePwdEyeBtn = (toBeOpen) => {
|
||||
isPwdEyeOn.value = toBeOpen;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user