feat: 所有用户如果使用默认密码登录,均强制要求修改密码

This commit is contained in:
taojinlong 2023-11-09 17:06:20 +08:00
parent 5275c28bd3
commit dcfaeb33b3
3 changed files with 12 additions and 2 deletions

View File

@ -196,6 +196,11 @@ public class AuthServer implements AuthApi {
}
if (user.getIsAdmin() && user.getPassword().equals("40b8893ea9ebc2d631c4bb42bb1e8996")) {
result.put("passwordModified", false);
result.put("defaultPwd", "dataease");
}
if (!user.getIsAdmin() && user.getPassword().equals("83d923c9f1d8fcaa46cae0ed2aaa81b5")) {
result.put("passwordModified", false);
result.put("defaultPwd", DEFAULT_PWD);
}
}

View File

@ -13,7 +13,7 @@
:title="$t('user.change_password')"
:show-close="false"
>
<PasswordUpdateForm old-pwd="dataease" />
<PasswordUpdateForm :old-pwd=defaultPwd />
</el-dialog>
</div>
</template>
@ -28,7 +28,8 @@ export default {
components: { PluginCom, PasswordUpdateForm },
data() {
return {
showPasswordModifiedDialog: false
showPasswordModifiedDialog: false,
defaultPwd: 'dataease'
}
},
computed: {
@ -46,6 +47,7 @@ export default {
},
mounted() {
const passwordModified = JSON.parse(localStorage.getItem('passwordModified'))
this.defaultPwd = localStorage.getItem('defaultPwd')
if (typeof passwordModified === 'boolean') {
this.$store.commit('user/SET_PASSWORD_MODIFIED', passwordModified)
}

View File

@ -86,6 +86,9 @@ const actions = {
if (Object.prototype.hasOwnProperty.call(data, 'passwordModified')) {
passwordModified = data.passwordModified
}
if (Object.prototype.hasOwnProperty.call(data, 'defaultPwd')) {
localStorage.setItem('defaultPwd', data.defaultPwd)
}
commit('SET_PASSWORD_MODIFIED', passwordModified)
localStorage.setItem('passwordModified', passwordModified)
resolve()