diff --git a/src/views/Home/Home.vue b/src/views/Home/Home.vue index 91db8e9..4cb587a 100644 --- a/src/views/Home/Home.vue +++ b/src/views/Home/Home.vue @@ -127,7 +127,7 @@ export default { if (Object.keys(this.row_pwd).length != 0) { // 有密码,已经输入过了 let now = new Date().getTime(); - if (now - this.row_pwd.create_time < 1000 * 60 * 5) { + if (now - this.row_pwd.create_time < 1000) { // 上次写入时间距离现在在五分钟之内 this.unlock = true; // 判断有无密码本 @@ -199,7 +199,7 @@ export default { // this.setRowPwd([row_pwd, this]); // console.log('主密码设置完成,返回init'); // this.init(); - if(type == '密码超时') this.$router.push({ name: "Unlock", params: { msg: 'Password validity period has expired, please re-enter' } }) + if(type == '密码超时') this.$router.push({ name: "Unlock", params: { msg: 'Password validity period has expired, please re-enter.' } }) else this.$router.push('/unlock') }, diff --git a/src/views/Unlock/Unlock.vue b/src/views/Unlock/Unlock.vue index 67594b1..1ff5a03 100644 --- a/src/views/Unlock/Unlock.vue +++ b/src/views/Unlock/Unlock.vue @@ -3,19 +3,25 @@

{{ is_create ? 'Create Password' : 'Unlock' }}

+ +

{{ is_create ? 'Create New Password' : 'Unlock Canary Codebook' }}

+ {{ err_msg }} + {{ err_msg }} + Enter + + {{ snakebar_msg }} @@ -47,7 +54,7 @@ export default { show_dialog: false, is_create: false, show_snackbar: false, - snakebar_msg:'' + snakebar_msg: '' }; }, computed: { @@ -67,12 +74,6 @@ export default { this.$store.replaceState(Object.assign(this.$store.state, JSON.parse(localStorage.getItem('storeState')))); // 判断是创建密码还是输入密码 this.is_create = this.row_data ? false : true; - // 判断是否显示SnakeBar - if (this.$route.params.msg) { - // 密码过期 - this.snakebar_msg = this.$route.params.msg - this.show_snackbar = true - } }, // 点击提交判断密码 @@ -85,7 +86,7 @@ export default { return; } // 判断是否有密码本 - if (this.row_data) { + if (!this.is_create) { // 有密码本 let test_decode = decrypt(this.pwd, this.row_data); // 解码成功这里边就是密码本,失败就是空字符串 @@ -132,7 +133,14 @@ export default { created() { this.init(); }, - mounted() {}, + mounted() { + // 判断是否显示SnakeBar + if (this.$route.params.msg) { + // 密码过期 + this.snakebar_msg = this.$route.params.msg; + this.show_snackbar = true; + } + }, watch: { // 如果 `pwd` 发生改变,就会清空错误状态 pwd: function() {