From d583ee91ff627890ce0a2a1055dcdc394d2391e2 Mon Sep 17 00:00:00 2001 From: xuefei <564615061@qq.cm> Date: 星期四, 04 五月 2023 09:55:18 +0800 Subject: [PATCH] 登录密码验证base64加密 --- src/views/main-components/user.vue | 59 +++++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 47 insertions(+), 12 deletions(-) diff --git a/src/views/main-components/user.vue b/src/views/main-components/user.vue index ce16b8f..a37dc1d 100644 --- a/src/views/main-components/user.vue +++ b/src/views/main-components/user.vue @@ -9,11 +9,11 @@ </div> </div> <DropdownMenu slot="list"> - <DropdownItem name="ownSpace"> - <Icon type="md-person" style="margin: 0 10px 0 0" />{{ - $t("userCenter") - }}</DropdownItem - > + <!--<DropdownItem name="ownSpace">--> + <!--<Icon type="md-person" style="margin: 0 10px 0 0" />{{--> + <!--$t("userCenter")--> + <!--}}</DropdownItem--> + <!-->--> <DropdownItem name="changePass"> <Icon type="md-unlock" style="margin: 0 10px 0 0" />{{ $t("changePass") @@ -36,6 +36,7 @@ import { getOtherSet } from "@/api/index"; import util from "@/libs/util.js"; import changePass from "@/views/change-pass/change-pass"; +import {getSessionStore} from "../../libs/storage"; export default { name: "user", components: { @@ -53,10 +54,44 @@ data() { return { showChangePass: false, + flag:0, }; }, methods: { - init() {}, + init() { + let psw = this.getStore("userInfo"); + psw = JSON.parse(psw).description; + this.checkStrengthValue(psw); + }, + checkStrengthValue(v) { + // 璇勭骇鍒跺垽鏂瘑鐮佸己搴� 鏈�楂�5 + let grade = 0; + if (/\d/.test(v)) { + grade++; //鏁板瓧 + } + if (/[a-z]/.test(v)) { + grade++; //灏忓啓 + } + if (/[A-Z]/.test(v)) { + grade++; //澶у啓 + } + if (/\W/.test(v)) { + grade++; //鐗规畩瀛楃 + } + if (v.length >= 8) { + grade++; + } + if(grade<5){ + this.showChangePass = true; + this.flag++; + if(this.flag>1){ + this.handleClickUserDropdown("loginout"); + } + setInterval(() => { + this.init(); + }, 1000*60) + } + }, handleClickUserDropdown(name) { if (name == "ownSpace") { util.openNewPage(this, "ownspace_index"); @@ -72,13 +107,13 @@ this.$store.commit("setLoading", false); if (res.result) { let domain = res.result.ssoDomain; - Cookies.set("accessToken", "", { - domain: domain, - expires: 7, - }); + // Cookies.set("accessToken", "", { + // domain: domain, + // expires: 7, + // }); } this.$store.commit("logout", this); - this.setStore("accessToken", ""); + this.setSessionStore("accessToken", "") // 寮哄埗鍒锋柊椤甸潰 閲嶆柊鍔犺浇router location.reload(); }); @@ -92,4 +127,4 @@ </script> <style lang="less" scoped> -</style> \ No newline at end of file +</style> -- Gitblit v1.9.1