fix the problem that the pin code can be set to other than 6 digits

This commit is contained in:
MaysWind
2020-11-21 12:03:15 +08:00
parent 7290835bb8
commit 218f8e8fec
3 changed files with 13 additions and 1 deletions
+1
View File
@@ -311,6 +311,7 @@ export default {
'Unable to verify': 'Unable to verify',
'Use a backup code': 'Use a backup code',
'Use a passcode': 'Use a passcode',
'PIN code is invalid': 'PIN code is invalid',
'PIN code is wrong': 'PIN code is wrong',
'Sign Up': 'Sign Up',
'Transaction Details': 'Transaction Details',
+1
View File
@@ -311,6 +311,7 @@ export default {
'Unable to verify': '无法验证',
'Use a backup code': '使用备用码',
'Use a passcode': '使用验证码',
'PIN code is invalid': 'PIN码无效',
'PIN code is wrong': 'PIN码错误',
'Sign Up': '注册',
'Transaction Details': '交易详情',
+11 -1
View File
@@ -38,7 +38,7 @@
<PincodeInput secure :length="6" v-model="currentPinCodeForEnable" />
</f7-list-item>
</f7-list>
<f7-button large fill :class="{ 'disabled': !currentPinCodeForEnable }" :text="$t('Continue')" @click="enable(currentPinCodeForEnable)"></f7-button>
<f7-button large fill :class="{ 'disabled': !currentPinCodeValid }" :text="$t('Continue')" @click="enable(currentPinCodeForEnable)"></f7-button>
<div class="margin-top text-align-center">
<f7-link @click="showInputPinCodeSheetForEnable = false" :text="$t('Cancel')"></f7-link>
</div>
@@ -57,6 +57,11 @@ export default {
showInputPinCodeSheetForEnable: false
};
},
computed: {
currentPinCodeValid() {
return this.currentPinCodeForEnable && this.currentPinCodeForEnable.length === 6;
}
},
methods: {
enable(pinCode) {
if (!pinCode) {
@@ -64,6 +69,11 @@ export default {
return;
}
if (!this.currentPinCodeValid) {
this.$alert('PIN code is invalid');
return;
}
this.$user.encryptToken(pinCode);
this.$settings.setEnableApplicationLock(true);
this.isEnableApplicationLock = true;