Authored by 陈峰

password

... ... @@ -29,6 +29,7 @@
<script>
import UserService from 'services/user/user-service';
import Vue from 'vue';
export default {
name: 'password',
... ... @@ -71,6 +72,7 @@ export default {
}).then(ret => {
if (ret.code === 200) {
this.loading = false;
Vue.prop('needUpdate', true);
this.$router.push('/');
} else {
this.loading = false;
... ...
... ... @@ -9,8 +9,6 @@ import crypto from 'util/crypto';
export default {
updateUser(Vue, user, purviews) {
Vue.$store.set(Vue.$config.storeKeys.user, crypto.aesEncrypt(user));
Vue.prop('user', user);
Vue.prop('isLogin', true);
Vue.prop('purviews', purviews.deep);
Vue.prop('oriPurviews', purviews.ori);
},
... ... @@ -47,6 +45,8 @@ export default {
if (isLogin && user) {
try {
user = crypto.aesDecrypt(user, Object);
Vue.prop('user', user);
Vue.prop('isLogin', true);
return Promise.all([
this.initPurview(Vue, user),
this.initConfig(Vue)
... ... @@ -80,6 +80,11 @@ export default {
return next('/login.html');
}
// 需求修改密码去修改密码
if (Vue.$needUpdate) {
return next('/password.html');
}
return this.checkPurview(Vue, to).then(() => {
return next();
}, () => {
... ... @@ -122,7 +127,7 @@ export default {
return false;
}
if (status === 403) {
Vue.$router.push('/password.html');
Vue.prop('needUpdate', true);
return false;
}
return true;
... ...
... ... @@ -14,14 +14,10 @@ module.exports = (req, res, next) => {
}
});
}
if (req.session.needUpdate) {
let path = req.headers.referer.replace(req.headers.origin, '');
if (path === '/password.html' || path === '/login.html') {
if (req.path === '/Api/erp/update') {
return next();
}
return res.status(403).json({
code: 403,
message: '抱歉,您暂未修改密码!',
... ...