code refactor

This commit is contained in:
MaysWind
2020-11-09 23:56:11 +08:00
parent b2b8dcb098
commit 8fa305212a
5 changed files with 138 additions and 114 deletions
+11 -7
View File
@@ -92,8 +92,6 @@
<script>
export default {
data() {
const self = this;
return {
username: '',
password: '',
@@ -103,15 +101,16 @@ export default {
logining: false,
verifying: false,
show2faSheet: false,
twoFAVerifyType: 'passcode',
twoFAVerifyTypeSwitchName: 'Use a backup code',
allLanguages: self.$getAllLanguages()
twoFAVerifyType: 'passcode'
};
},
computed: {
version() {
return 'v' + this.$version();
},
allLanguages() {
return this.$getAllLanguages();
},
isUserRegistrationEnabled() {
return this.$isUserRegistrationEnabled();
},
@@ -125,6 +124,13 @@ export default {
return !this.passcode;
}
},
twoFAVerifyTypeSwitchName() {
if (this.twoFAVerifyType === 'backupcode') {
return 'Use a passcode';
} else {
return 'Use a backup code';
}
},
currentLanguageName() {
const currentLocale = this.$i18n.locale;
let lang = this.$getLanguage(currentLocale);
@@ -251,10 +257,8 @@ export default {
switch2FAVerifyType() {
if (this.twoFAVerifyType === 'passcode') {
this.twoFAVerifyType = 'backupcode';
this.twoFAVerifyTypeSwitchName = 'Use a passcode';
} else {
this.twoFAVerifyType = 'passcode';
this.twoFAVerifyTypeSwitchName = 'Use a backup code';
}
},
changeLanguage(locale) {