Skip to content

Commit

Permalink
🔨 Check all inputs on account settings at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
devmount committed Sep 13, 2024
1 parent 640e321 commit bdc9835
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frontend/src/components/SettingsAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,22 @@ const updateUser = async () => {
* If it didn't change, then just update the user immediately.
*/
const updateUserCheckForConfirmation = async () => {
errorUsername.value = null;
errorDisplayName.value = null;
// Validate username
if (activeUsername.value === '') {
errorUsername.value = t('validation.fieldIsRequired', { field: t('label.username') });
return;
}
if (hasProfanity(activeUsername.value)) {
errorUsername.value = t('validation.fieldContainsProfanity', { field: t('label.username') });
return;
}
// Validate display name
if (hasProfanity(activeDisplayName.value)) {
errorDisplayName.value = t('validation.fieldContainsProfanity', { field: t('label.displayName') });
}
if (errorUsername.value || errorDisplayName.value) {
return;
}
Expand Down

0 comments on commit bdc9835

Please sign in to comment.