diff --git a/src/locales/en.js b/src/locales/en.js index 40109783..fde63d13 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -72,7 +72,9 @@ export default { 'hoursAheadOfDefaultTimezone': '{hours} hour(s) ahead of default timezone', 'hoursMinutesBehindDefaultTimezone': '{hours} hour(s) and {minutes} minutes behind default timezone', 'hoursMinutesAheadOfDefaultTimezone': '{hours} hour(s) and {minutes} minutes ahead of default timezone', - 'youHaveAccounts': 'You have recorded {count} accounts' + 'youHaveAccounts': 'You have recorded {count} accounts', + 'accountActivationAndResendValidationEmailTip': 'Account activation link has been sent to your email address: {email}, If you don\'t receive the mail, please fill password again and click the button below to resend the validation mail.', + 'resendValidationEmailTip': 'If you don\'t receive the mail, please fill password again and click the button below to resend the validation mail to: {email}' } }, 'dataExport': { @@ -854,9 +856,6 @@ export default { 'PIN code is wrong': 'PIN code is wrong', 'Verify your email': 'Verify your email', 'Verifying...': 'Verifying...', - 'Account activation link has been sent to your email address:': 'Account activation link has been sent to your email address:', - ', If you don\'t receive the mail, fill password and click the button below to resend the verify mail.': ', If you don\'t receive the mail, fill password and click the button below to resend the verify mail.', - 'If you don\'t receive the mail, fill password and click the button below to resend the verify mail to:': 'If you don\'t receive the mail, fill password and click the button below to resend the verify mail to:', 'Resend Validation Email': 'Resend Validation Email', 'Validation email has been sent': 'Validation email has been sent', 'Unable to verify email': 'Unable to verify email', diff --git a/src/locales/zh_Hans.js b/src/locales/zh_Hans.js index 110bd664..4b1af0c1 100644 --- a/src/locales/zh_Hans.js +++ b/src/locales/zh_Hans.js @@ -72,7 +72,9 @@ export default { 'hoursAheadOfDefaultTimezone': '比默认时区早{hours}小时', 'hoursMinutesBehindDefaultTimezone': '比默认时区晚{hours}小时{minutes}分', 'hoursMinutesAheadOfDefaultTimezone': '比默认时区早{time}小时{minutes}分', - 'youHaveAccounts': '您已经记录了 {count} 个账户' + 'youHaveAccounts': '您已经记录了 {count} 个账户', + 'accountActivationAndResendValidationEmailTip': '账号激活链接已经发送到您的邮箱地址:{email},如果您没有收到邮件,请再次输入密码并点击下方的按钮重新发送验证邮件。', + 'resendValidationEmailTip': '如果您没有收到邮件,请再次输入密码并点击下方的按钮重新发送验证邮件到:{email}' } }, 'dataExport': { @@ -854,9 +856,6 @@ export default { 'PIN code is wrong': 'PIN码错误', 'Verify your email': '验证您的邮箱', 'Verifying...': '正在验证...', - 'Account activation link has been sent to your email address:': '账号激活链接已经发送到您的邮箱地址:', - ', If you don\'t receive the mail, fill password and click the button below to resend the verify mail.': ',如果您没有收到邮件,输入密码并点击下方的按钮重新发送验证邮件。', - 'If you don\'t receive the mail, fill password and click the button below to resend the verify mail to:': '如果您没有收到邮件,输入密码并点击下方的按钮重新发送验证邮件到:', 'Resend Validation Email': '重发验证邮件', 'Validation email has been sent': '验证邮件已发送', 'Unable to verify email': '无法验证邮箱', diff --git a/src/views/desktop/VerifyEmailPage.vue b/src/views/desktop/VerifyEmailPage.vue index f7380411..ae10974a 100644 --- a/src/views/desktop/VerifyEmailPage.vue +++ b/src/views/desktop/VerifyEmailPage.vue @@ -27,13 +27,7 @@

{{ $t('Email has been verified') }}

{{ errorMessage }}

{{ $t('Parameter Invalid') }}

-

- {{ $t('Account activation link has been sent to your email address:') }} - {{ email }} - {{ $t(', If you don\'t receive the mail, fill password and click the button below to resend the verify mail.') }} - {{ $t('If you don\'t receive the mail, fill password and click the button below to resend the verify mail to:') }} - {{ email }} -

+

{{ $t(hasValidEmailVerifyToken ? 'format.misc.accountActivationAndResendValidationEmailTip' : 'format.misc.resendValidationEmailTip', { email: email }) }}

diff --git a/src/views/mobile/LoginPage.vue b/src/views/mobile/LoginPage.vue index d0a2ae2a..a8b8c3e4 100644 --- a/src/views/mobile/LoginPage.vue +++ b/src/views/mobile/LoginPage.vue @@ -162,6 +162,15 @@ + + + @@ -172,7 +181,11 @@ import { useSettingsStore } from '@/stores/setting.js'; import { useExchangeRatesStore } from '@/stores/exchangeRates.js'; import assetConstants from '@/consts/asset.js'; -import { isUserRegistrationEnabled, isUserForgetPasswordEnabled } from '@/lib/server_settings.js'; +import { + isUserRegistrationEnabled, + isUserForgetPasswordEnabled, + isUserVerifyEmailEnabled +} from '@/lib/server_settings.js'; import { getDesktopVersionPath } from '@/lib/version.js'; import { isModalShowing } from '@/lib/ui.mobile.js'; @@ -188,11 +201,16 @@ export default { backupCode: '', tempToken: '', forgetPasswordEmail: '', + resendVerifyEmail: '', + hasValidEmailVerifyToken: false, + currentPasswordForResendVerifyEmail: '', logining: false, verifying: false, requestingForgetPassword: false, + requestingResendVerifyEmail: false, show2faSheet: false, showForgetPasswordSheet: false, + showVerifyEmailSheet: false, twoFAVerifyType: 'passcode' }; }, @@ -238,6 +256,9 @@ export default { }, currentLanguageName() { return this.$locale.getCurrentLanguageDisplayName(); + }, + isUserVerifyEmailEnabled() { + return isUserVerifyEmailEnabled(); } }, methods: { @@ -261,6 +282,9 @@ export default { } self.logining = true; + self.resendVerifyEmail = ''; + self.hasValidEmailVerifyToken = false; + self.currentPasswordForResendVerifyEmail = ''; self.$showLoading(() => self.logining); self.rootStore.authorize({ @@ -290,6 +314,14 @@ export default { self.logining = false; self.$hideLoading(); + if (self.isUserVerifyEmailEnabled && error.error && error.error.errorCode === 201020 && error.error.context && error.error.context.email) { + self.resendVerifyEmail = error.error.context.email; + self.hasValidEmailVerifyToken = error.error.context.hasValidEmailVerifyToken || false; + self.currentPasswordForResendVerifyEmail = ''; + self.showVerifyEmailSheet = true; + return; + } + if (!error.processed) { self.$toast(error.message || error); } @@ -376,6 +408,35 @@ export default { } }); }, + requestResendVerifyEmail() { + const self = this; + + if (!self.currentPasswordForResendVerifyEmail) { + self.$toast('Current password cannot be empty'); + return; + } + + self.requestingResendVerifyEmail = true; + self.$showLoading(() => self.requestingResendVerifyEmail); + + self.rootStore.resendVerifyEmailByUnloginUser({ + email: self.resendVerifyEmail, + password: self.currentPasswordForResendVerifyEmail + }).then(() => { + self.requestingResendVerifyEmail = false; + self.$hideLoading(); + + self.$toast('Validation email has been sent'); + self.showVerifyEmailSheet = false; + }).catch(error => { + self.requestingResendVerifyEmail = false; + self.$hideLoading(); + + if (!error.processed) { + self.$toast(error.message || error); + } + }); + }, switch2FAVerifyType() { if (this.twoFAVerifyType === 'passcode') { this.twoFAVerifyType = 'backupcode';