code refactor

This commit is contained in:
MaysWind
2023-08-26 23:35:53 +08:00
parent 9ee59215c8
commit c66bc62c41
2 changed files with 8 additions and 8 deletions
+5 -5
View File
@@ -281,7 +281,7 @@ export default {
self.tempToken = authResponse.token;
self.show2faInput = true;
this.$nextTick(() => {
self.$nextTick(() => {
if (self.$refs.passcodeInput) {
self.$refs.passcodeInput.focus();
self.$refs.passcodeInput.select();
@@ -300,7 +300,7 @@ export default {
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
}
this.$router.replace('/');
self.$router.replace('/');
}).catch(error => {
self.logining = false;
@@ -316,10 +316,10 @@ export default {
return;
}
if (this.twoFAVerifyType === 'passcode' && !this.passcode) {
if (self.twoFAVerifyType === 'passcode' && !self.passcode) {
self.$refs.snackbar.showMessage('Passcode cannot be empty');
return;
} else if (this.twoFAVerifyType === 'backupcode' && !this.backupCode) {
} else if (self.twoFAVerifyType === 'backupcode' && !self.backupCode) {
self.$refs.snackbar.showMessage('Backup code cannot be empty');
return;
}
@@ -342,7 +342,7 @@ export default {
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
}
this.$router.replace('/');
self.$router.replace('/');
}).catch(error => {
self.verifying = false;
+3 -3
View File
@@ -171,13 +171,13 @@ export default {
return;
}
this.verifyingByWebAuthn = true;
self.verifyingByWebAuthn = true;
webauthn.verifyCredential(
self.userStore.currentUserInfo,
self.$user.getWebAuthnCredentialId()
).then(({ id, userName, userSecret }) => {
this.verifyingByWebAuthn = false;
self.verifyingByWebAuthn = false;
self.$user.unlockTokenByWebAuthn(id, userName, userSecret);
self.tokensStore.refreshTokenAndRevokeOldToken().then(response => {
@@ -193,7 +193,7 @@ export default {
self.$router.replace('/');
}).catch(error => {
this.verifyingByWebAuthn = false;
self.verifyingByWebAuthn = false;
logger.error('failed to use webauthn to verify', error);
if (error.notSupported) {