Skip to content

Commit

Permalink
feat:添加日志记录并修复更换密码校验器的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro committed Jun 10, 2019
1 parent f8b8669 commit 65e6f38
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions app/config/log.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

module.exports = {
log: {
level: 'DEBUG',
dir: 'logs',
sizeLimit: 1024 * 1024 * 5,
requestLog: true
}
};
2 changes: 1 addition & 1 deletion app/starter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const run = async () => {
const app = await createApp();
const port = config.getItem('port');
app.listen(port, () => {
app.context.logger.start(`listening at http://localhost:${port}`);
app.context.logger.info(`listening at http://localhost:${port}`);
});
};
// 启动应用
Expand Down
3 changes: 2 additions & 1 deletion app/validators/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class ChangePasswordValidator extends LinValidator {
super();
this.new_password = new Rule(
'matches',
'密码长度必须在6~22位之间,包含字符、数字和 _ '
'密码长度必须在6~22位之间,包含字符、数字和 _ ',
/^[A-Za-z0-9_*&$#@]{6,22}$/
);
this.confirm_password = new Rule('isNotEmpty', '确认密码不可为空');
this.old_password = new Rule('isNotEmpty', '请输入旧密码');
Expand Down

0 comments on commit 65e6f38

Please sign in to comment.