Commit dc1706fb429bafb5522786f0a50ed18d9552dc24
1 parent
9ec51cda
把登录页密码框改成了文本框,输入的时候自动转*,防止浏览器记住密码
Showing
1 changed file
with
12 additions
and
2 deletions
ant-design-vue-jeecg/src/views/user/LoginAccount.vue
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | </a-input> |
8 | 8 | </a-form-model-item> |
9 | 9 | <a-form-model-item required prop="password"> |
10 | - <a-input v-model="model.password" size="large" type="password" autocomplete="off" | |
10 | + <a-input v-model="model.password" size="large" type="text" autocomplete="off" @input="maskPassword" | |
11 | 11 | placeholder="请输入密码 / 123456" > |
12 | 12 | <a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/> |
13 | 13 | </a-input> |
... | ... | @@ -44,6 +44,7 @@ export default { |
44 | 44 | requestCodeSuccess: false, |
45 | 45 | randCodeImage: '', |
46 | 46 | currdatetime: '', |
47 | + maskedPassword: '', | |
47 | 48 | loginType: 0, |
48 | 49 | warehouseList: {}, |
49 | 50 | querySource: {}, |
... | ... | @@ -103,6 +104,15 @@ export default { |
103 | 104 | }) |
104 | 105 | }, |
105 | 106 | |
107 | + maskPassword() { | |
108 | + if (this.model.password.length<this.maskedPassword.length){ | |
109 | + let len=this.maskedPassword.length-this.model.password.length | |
110 | + this.maskedPassword=this.maskedPassword.substring(0,this.maskedPassword.length - len) | |
111 | + }else{ | |
112 | + this.maskedPassword = this.maskedPassword + this.model.password.substring(this.model.password.length - 1, this.model.password.length) | |
113 | + } | |
114 | + this.model.password = '*'.repeat(this.model.password.length); | |
115 | + }, | |
106 | 116 | // 判断登录类型 |
107 | 117 | handleUsernameOrEmail(rule, value, callback) { |
108 | 118 | const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/; |
... | ... | @@ -147,7 +157,7 @@ export default { |
147 | 157 | if (!err) { |
148 | 158 | let loginParams = { |
149 | 159 | username: this.model.username, |
150 | - password: this.model.password, | |
160 | + password: this.maskedPassword, | |
151 | 161 | warehouseCode: this.model.warehouseCode, |
152 | 162 | checkKey: this.currdatetime, |
153 | 163 | remember_me: rememberMe, |
... | ... |