diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2021-09-15 14:12:10 +0300 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2021-09-15 16:38:49 +0300 |
commit | d93e2548f0b1b2a464b8ce8eaff520627f9ac2dc (patch) | |
tree | 859e7635100904dcd0879b92ed82298983cf03cd /apps/settings/src | |
parent | fe5e67265428dfe0cb2ff221cfe62da03df95038 (diff) |
only offer to set locally verified mails as primary
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/settings/src')
3 files changed, 18 insertions, 3 deletions
diff --git a/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue b/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue index 8095152fd43..f56dcce917c 100644 --- a/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue +++ b/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue @@ -68,7 +68,7 @@ <ActionButton :aria-label="setNotificationMailLabel" :close-after-click="true" - :disabled="setNotificationDisabled" + :disabled="setNotificationMailDisabled" icon="icon-favorite" @click.stop.prevent="setNotificationMail"> {{ setNotificationMailLabel }} @@ -91,7 +91,7 @@ import debounce from 'debounce' import FederationControl from '../shared/FederationControl' -import {ACCOUNT_PROPERTY_READABLE_ENUM} from '../../../constants/AccountPropertyConstants' +import {ACCOUNT_PROPERTY_READABLE_ENUM, VERIFICATION_ENUM} from '../../../constants/AccountPropertyConstants' import { removeAdditionalEmail, saveAdditionalEmail, @@ -132,6 +132,10 @@ export default { type: String, default: '', }, + localVerificationState: { + type: Number, + default: VERIFICATION_ENUM.NOT_VERIFIED, + }, }, data() { @@ -166,13 +170,16 @@ export default { return t('settings', 'Delete email') }, - setNotificationDisabled() { + setNotificationMailDisabled() { return this.isNotificationEmail + || (!this.primary && this.localVerificationState !== VERIFICATION_ENUM.VERIFIED) }, setNotificationMailLabel() { if (this.isNotificationEmail) { return t('settings', 'Your primary email') + } else if (!this.primary && this.localVerificationState !== VERIFICATION_ENUM.VERIFIED) { + return t('settings', 'This address is not confirmed') } return t('settings', 'Set as primary mail') }, diff --git a/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue b/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue index 709029e1894..8424dee774e 100644 --- a/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue +++ b/apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue @@ -47,6 +47,7 @@ :index="index" :scope.sync="additionalEmail.scope" :email.sync="additionalEmail.value" + :local-verification-state="parseInt(additionalEmail.locallyVerified, 10)" :active-notification-email.sync="notificationEmail" @update:email="onUpdateEmail" @delete-additional-email="onDeleteAdditionalEmail(index)" /> diff --git a/apps/settings/src/constants/AccountPropertyConstants.js b/apps/settings/src/constants/AccountPropertyConstants.js index 9d3fd4ee97b..95bf3a87dfb 100644 --- a/apps/settings/src/constants/AccountPropertyConstants.js +++ b/apps/settings/src/constants/AccountPropertyConstants.js @@ -119,6 +119,13 @@ export const SCOPE_PROPERTY_ENUM = Object.freeze({ /** Default additional email scope */ export const DEFAULT_ADDITIONAL_EMAIL_SCOPE = SCOPE_ENUM.LOCAL +/** Enum of verification constants, according to IAccountManager */ +export const VERIFICATION_ENUM = Object.freeze({ + NOT_VERIFIED: 0, + VERIFICATION_IN_PROGRESS: 1, + VERIFIED: 2, +}) + /** * Email validation regex * |