support resending verify mail on mobile device

This commit is contained in:
MaysWind
2023-09-17 19:32:12 +08:00
parent b0ae731fa6
commit afcd4f7262
4 changed files with 69 additions and 16 deletions
+3 -4
View File
@@ -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',
+3 -4
View File
@@ -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': '无法验证邮箱',
+1 -7
View File
@@ -27,13 +27,7 @@
<p class="mb-0" v-if="token && verified">{{ $t('Email has been verified') }}</p>
<p class="mb-0" v-if="token && !verified && errorMessage">{{ errorMessage }}</p>
<p class="mb-0" v-if="!token && !email">{{ $t('Parameter Invalid') }}</p>
<p class="mb-0" v-if="!token && email">
<span v-if="hasValidEmailVerifyToken">{{ $t('Account activation link has been sent to your email address:') }}</span>
<span class="ml-1" v-if="hasValidEmailVerifyToken">{{ email }}</span>
<span class="ml-1" v-if="hasValidEmailVerifyToken">{{ $t(', If you don\'t receive the mail, fill password and click the button below to resend the verify mail.') }}</span>
<span v-if="!hasValidEmailVerifyToken">{{ $t('If you don\'t receive the mail, fill password and click the button below to resend the verify mail to:') }}</span>
<span class="ml-1" v-if="!hasValidEmailVerifyToken">{{ email }}</span>
</p>
<p class="mb-0" v-if="!token && email">{{ $t(hasValidEmailVerifyToken ? 'format.misc.accountActivationAndResendValidationEmailTip' : 'format.misc.resendValidationEmailTip', { email: email }) }}</p>
</v-card-text>
<v-card-text class="pb-0 mb-6">
+62 -1
View File
@@ -162,6 +162,15 @@
</div>
</f7-page-content>
</f7-sheet>
<password-input-sheet :title="$t('Verify your email')"
:hint="$t(hasValidEmailVerifyToken ? 'format.misc.accountActivationAndResendValidationEmailTip' : 'format.misc.resendValidationEmailTip', { email: resendVerifyEmail })"
:confirm-disabled="requestingResendVerifyEmail"
:cancel-disabled="requestingResendVerifyEmail"
v-model:show="showVerifyEmailSheet"
v-model="currentPasswordForResendVerifyEmail"
@password:confirm="requestResendVerifyEmail">
</password-input-sheet>
</f7-page>
</template>
@@ -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';