diff --git a/sgzb-ui/src/router/index.js b/sgzb-ui/src/router/index.js index 47487f73..6f55affa 100644 --- a/sgzb-ui/src/router/index.js +++ b/sgzb-ui/src/router/index.js @@ -105,8 +105,11 @@ export const constantRoutes = [ path: '/qrCode/qrCodePage', component: () => import('@/views/qrCode/qrCode'), hidden: true - - + }, + { + path: '/resetPassword', + component: () => import('@/views/resetPassword'), + hidden: true } ] diff --git a/sgzb-ui/src/store/modules/user.js b/sgzb-ui/src/store/modules/user.js index de69d2fa..f8d66d17 100644 --- a/sgzb-ui/src/store/modules/user.js +++ b/sgzb-ui/src/store/modules/user.js @@ -48,7 +48,7 @@ const user = { return new Promise((resolve, reject) => { login(username, password, code, uuid).then(res => { let data = res.data - localStorage.setItem('isCode', data.code) + localStorage.setItem('isCode', data.code || '') setToken(data.access_token) commit('SET_TOKEN', data.access_token) localStorage.setItem('token', data.access_token) @@ -155,6 +155,7 @@ const user = { commit('SET_ROLES', []) commit('SET_PERMISSIONS', []) removeToken() + localStorage.removeItem('isCode') resolve() }).catch(error => { reject(error) diff --git a/sgzb-ui/src/views/login.vue b/sgzb-ui/src/views/login.vue index d699a26d..be4ce030 100644 --- a/sgzb-ui/src/views/login.vue +++ b/sgzb-ui/src/views/login.vue @@ -19,6 +19,7 @@ type="password" auto-complete="off" placeholder="密码" + show-password @keyup.enter.native="handleLogin" > @@ -299,7 +300,13 @@ export default { this.$store .dispatch('Login', this.loginForm) .then(() => { - this.$router.push({ path: '/' }).catch(() => {}) + if (localStorage.getItem('isCode') == 1) { + this.$router + .push({ path: '/resetPassword' }) + .catch(() => {}) + } else { + this.$router.push({ path: '/' }).catch(() => {}) + } }) .catch(() => { this.loading = false diff --git a/sgzb-ui/src/views/resetPassword.vue b/sgzb-ui/src/views/resetPassword.vue index b6f01594..c0817da8 100644 --- a/sgzb-ui/src/views/resetPassword.vue +++ b/sgzb-ui/src/views/resetPassword.vue @@ -1,246 +1,237 @@ - - - - 请重置登录密码 - - - - - - - - - - - - 确认修改 - 返回登录页 - - - - - + + + + 请重置登录密码 + + + + + + + + + + + + 确认修改 + 返回登录页 + + + + + diff --git a/sgzb-ui/src/views/system/user/index.vue b/sgzb-ui/src/views/system/user/index.vue index 0e005027..99331856 100644 --- a/sgzb-ui/src/views/system/user/index.vue +++ b/sgzb-ui/src/views/system/user/index.vue @@ -551,6 +551,7 @@ import { import { getToken } from '@/utils/auth' import Treeselect from '@riophae/vue-treeselect' import '@riophae/vue-treeselect/dist/vue-treeselect.css' +import { encrypt, decrypt } from '@/utils/jsencrypt' export default { name: 'User', @@ -698,7 +699,7 @@ export default { this.getList() this.getDeptTree() this.getConfigKey('sys.user.initPassword').then((response) => { - this.initPassword = response.msg + this.initPassword = decrypt(response.msg) }) }, methods: { @@ -837,8 +838,9 @@ export default { inputErrorMessage: '用户密码长度必须介于 5 和 20 之间', }) .then(({ value }) => { - resetUserPwd(row.userId, value).then((response) => { - this.$modal.msgSuccess('修改成功,新密码是:' + value) + const password = encrypt(value) + resetUserPwd(row.userId, password).then((response) => { + this.$modal.msgSuccess('修改成功') }) }) .catch(() => {}) diff --git a/sgzb-ui/src/views/system/user/profile/resetPwd.vue b/sgzb-ui/src/views/system/user/profile/resetPwd.vue index 3dd669ec..962e83ab 100644 --- a/sgzb-ui/src/views/system/user/profile/resetPwd.vue +++ b/sgzb-ui/src/views/system/user/profile/resetPwd.vue @@ -19,6 +19,7 @@