diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-10-20 21:37:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-20 21:37:39 +0200 |
commit | b0956b1a00e9fb0d4e2db8aa576917ce77b20cd5 (patch) | |
tree | 99e43daa6beb8d6171892b8f2b720eadfc4cc958 /apps/settings | |
parent | df74fb012305111bd3727bdcf8248568cd3cb5c1 (diff) | |
parent | 7c142c9aed5f479650069ed7cdb1fa34e72b03f3 (diff) | |
download | nextcloud-server-b0956b1a00e9fb0d4e2db8aa576917ce77b20cd5.tar.gz nextcloud-server-b0956b1a00e9fb0d4e2db8aa576917ce77b20cd5.zip |
Merge pull request #40983 from nextcloud/fix/37092/personal-settings--html-validation
HTML Validation: Personal settings
Diffstat (limited to 'apps/settings')
7 files changed, 22 insertions, 47 deletions
diff --git a/apps/settings/src/components/PersonalInfo/AvatarSection.vue b/apps/settings/src/components/PersonalInfo/AvatarSection.vue index a2ee65152bb..9c56fe277af 100644 --- a/apps/settings/src/components/PersonalInfo/AvatarSection.vue +++ b/apps/settings/src/components/PersonalInfo/AvatarSection.vue @@ -35,8 +35,7 @@ :key="version" :user="userId" :aria-label="t('settings', 'Your profile picture')" - :disabled-menu="true" - :disabled-tooltip="true" + :disable-tooltip="true" :show-user-status="false" :size="180" /> <div v-else class="icon-loading" /> diff --git a/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue b/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue index 7b5d4c11028..1fff440c50e 100644 --- a/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue +++ b/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue @@ -23,13 +23,14 @@ <template> <div> <div class="email"> - <input :id="inputId" + <input :id="inputIdWithDefault" ref="email" type="email" autocomplete="email" + :aria-label="inputPlaceholder" :placeholder="inputPlaceholder" :value="email" - :aria-describedby="helperText ? `${inputId}-helper-text` : ''" + :aria-describedby="helperText ? `${inputIdWithDefault}-helper-text` : undefined" autocapitalize="none" spellcheck="false" @input="onEmailChange"> @@ -73,7 +74,7 @@ </div> <p v-if="helperText" - :id="`${inputId}-helper-text`" + :id="`${inputIdWithDefault}-helper-text`" class="email__helper-text-message email__helper-text-message--error"> <AlertCircle class="email__helper-text-message__icon" :size="18" /> {{ helperText }} @@ -144,6 +145,11 @@ export default { type: Number, default: VERIFICATION_ENUM.NOT_VERIFIED, }, + inputId: { + type: String, + required: false, + default: '', + }, }, data() { @@ -194,18 +200,13 @@ export default { return !this.initialEmail }, - inputId() { - if (this.primary) { - return 'email' - } - return `email-${this.index}` + inputIdWithDefault() { + return this.inputId || `account-property-email--${this.index}` }, inputPlaceholder() { - if (this.primary) { - return t('settings', 'Your email address') - } - return t('settings', 'Additional email address {index}', { index: this.index + 1 }) + // Primary email has implicit linked <label> + return !this.primary ? t('settings', 'Additional email address {index}', { index: this.index + 1 }) : undefined }, isNotificationEmail() { diff --git a/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue b/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue index 980af3e62b0..0cc94b4998a 100644 --- a/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue +++ b/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue @@ -24,7 +24,6 @@ <section> <HeaderBar :input-id="inputId" :readable="primaryEmail.readable" - :handle-scope-change="savePrimaryEmailScope" :is-editable="true" :is-multi-value-supported="true" :is-valid-section="isValidSection" @@ -32,7 +31,8 @@ @add-additional="onAddAdditionalEmail" /> <template v-if="displayNameChangeSupported"> - <Email :primary="true" + <Email :input-id="inputId" + :primary="true" :scope.sync="primaryEmail.scope" :email.sync="primaryEmail.value" :active-notification-email.sync="notificationEmail" @@ -68,7 +68,7 @@ import Email from './Email.vue' import HeaderBar from '../shared/HeaderBar.vue' import { ACCOUNT_PROPERTY_READABLE_ENUM, DEFAULT_ADDITIONAL_EMAIL_SCOPE, NAME_READABLE_ENUM } from '../../../constants/AccountPropertyConstants.js' -import { savePrimaryEmail, savePrimaryEmailScope, removeAdditionalEmail } from '../../../service/PersonalInfo/EmailService.js' +import { savePrimaryEmail, removeAdditionalEmail } from '../../../service/PersonalInfo/EmailService.js' import { validateEmail } from '../../../utils/validate.js' import { handleError } from '../../../utils/handlers.js' @@ -89,7 +89,6 @@ export default { additionalEmails: additionalEmails.map(properties => ({ ...properties, key: this.generateUniqueKey() })), displayNameChangeSupported, primaryEmail: { ...primaryEmail, readable: NAME_READABLE_ENUM[primaryEmail.name] }, - savePrimaryEmailScope, notificationEmail, } }, diff --git a/apps/settings/src/components/PersonalInfo/LanguageSection/Language.vue b/apps/settings/src/components/PersonalInfo/LanguageSection/Language.vue index bacc687c58e..cf921b5809f 100644 --- a/apps/settings/src/components/PersonalInfo/LanguageSection/Language.vue +++ b/apps/settings/src/components/PersonalInfo/LanguageSection/Language.vue @@ -22,9 +22,7 @@ <template> <div class="language"> - <select :id="inputId" - :placeholder="t('settings', 'Language')" - @change="onLanguageChange"> + <select :id="inputId" @change="onLanguageChange"> <option v-for="commonLanguage in commonLanguages" :key="commonLanguage.code" :selected="language.code === commonLanguage.code" diff --git a/apps/settings/src/components/PersonalInfo/LocaleSection/Locale.vue b/apps/settings/src/components/PersonalInfo/LocaleSection/Locale.vue index 6f296a6c124..b405d7fced4 100644 --- a/apps/settings/src/components/PersonalInfo/LocaleSection/Locale.vue +++ b/apps/settings/src/components/PersonalInfo/LocaleSection/Locale.vue @@ -22,9 +22,7 @@ <template> <div class="locale"> - <select :id="inputId" - :placeholder="t('settings', 'Locale')" - @change="onLocaleChange"> + <select :id="inputId" @change="onLocaleChange"> <option v-for="currentLocale in localesForLanguage" :key="currentLocale.code" :selected="locale.code === currentLocale.code" diff --git a/apps/settings/src/components/PersonalInfo/shared/AccountPropertySection.vue b/apps/settings/src/components/PersonalInfo/shared/AccountPropertySection.vue index 8cf92fe32ed..c9b74eeb3f4 100644 --- a/apps/settings/src/components/PersonalInfo/shared/AccountPropertySection.vue +++ b/apps/settings/src/components/PersonalInfo/shared/AccountPropertySection.vue @@ -43,17 +43,17 @@ :placeholder="placeholder" :type="type" :value="value" - :aria-describedby="helperText ? `${name}-helper-text` : ''" + :aria-describedby="helperText ? `${name}-helper-text` : undefined" autocapitalize="none" spellcheck="false" :autocomplete="autocomplete" @input="onPropertyChange"> <div class="property__actions-container"> - <transition name="fade"> + <Transition name="fade"> <Check v-if="showCheckmarkIcon" :size="20" /> <AlertOctagon v-else-if="showErrorIcon" :size="20" /> - </transition> + </Transition> </div> </div> <span v-else> diff --git a/apps/settings/src/service/PersonalInfo/EmailService.js b/apps/settings/src/service/PersonalInfo/EmailService.js index 535bd6a2295..f8256f0bdc0 100644 --- a/apps/settings/src/service/PersonalInfo/EmailService.js +++ b/apps/settings/src/service/PersonalInfo/EmailService.js @@ -132,26 +132,6 @@ export const updateAdditionalEmail = async (prevEmail, newEmail) => { } /** - * Save the federation scope for the primary email of the user - * - * @param {string} scope the federation scope - * @return {object} - */ -export const savePrimaryEmailScope = async (scope) => { - const userId = getCurrentUser().uid - const url = generateOcsUrl('cloud/users/{userId}', { userId }) - - await confirmPassword() - - const res = await axios.put(url, { - key: `${ACCOUNT_PROPERTY_ENUM.EMAIL}${SCOPE_SUFFIX}`, - value: scope, - }) - - return res.data -} - -/** * Save the federation scope for the additional email of the user * * @param {string} email the additional email |