|
@@ -476,6 +476,11 @@ module.exports = app => {
|
|
|
// 获取验证规则
|
|
|
const rule = ctx.service.projectAccount.rule('add');
|
|
|
ctx.validate(rule);
|
|
|
+ // 判断新密码的强度
|
|
|
+ const reg = /^(?![0-9]+$)(?![a-zA-Z]+$).{6,16}$/;
|
|
|
+ if (!reg.test(ctx.request.body.password)) {
|
|
|
+ throw '请设置至少包含数字和字母的密码';
|
|
|
+ }
|
|
|
ctx.request.body.project_id = projectData.id;
|
|
|
const result = await ctx.service.projectAccount.save(ctx.request.body);
|
|
|
if (!result) {
|
|
@@ -486,6 +491,7 @@ module.exports = app => {
|
|
|
ctx.redirect('/' + ctx.controllerName + '/user');
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
+ ctx.session.postError = error.toString();
|
|
|
this.setMessage(error.toString(), this.messageType.ERROR);
|
|
|
ctx.redirect(ctx.request.header.referer);
|
|
|
}
|
|
@@ -544,7 +550,7 @@ module.exports = app => {
|
|
|
// 判断新密码的强度
|
|
|
const reg = /^(?![0-9]+$)(?![a-zA-Z]+$).{6,16}$/;
|
|
|
if (!reg.test(password)) {
|
|
|
- throw '请设置至少包含数字和字母的新密码';
|
|
|
+ throw '请设置至少包含数字和字母的密码';
|
|
|
}
|
|
|
const result = await ctx.service.projectAccount.resetPassword(accountId, password, account);
|
|
|
if (!result) {
|