Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix login usename or pwd err notice '用户名或者密码错误'
  • Loading branch information
momaek committed Feb 26, 2018
commit ac01b21e00a264f6c43dfb696ac84201f70e366e
6 changes: 4 additions & 2 deletions src/logic/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ func (UserLogic) Total() int64 {
var (
ErrUsername = errors.New("用户名不存在")
ErrPasswd = errors.New("密码错误")

ErrUnameOrPwd = errors.New("用户名或密码错误")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

告知用户名或密码错误,是怕猜测吗?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)

// Login 登录;成功返回用户登录信息(user_login)
Expand All @@ -385,7 +387,7 @@ func (self UserLogic) Login(ctx context.Context, username, passwd string) (*mode
// 校验用户
if userLogin.Uid == 0 {
objLog.Infof("user %q is not exists!", username)
return nil, ErrUsername
return nil, ErrUnameOrPwd
}

// 检验用户状态是否正常(未激活的可以登录,但不能发布信息)
Expand All @@ -405,7 +407,7 @@ func (self UserLogic) Login(ctx context.Context, username, passwd string) (*mode
objLog.Debugf("passwd: %s, passcode: %s, md5passwd: %s, dbpasswd: %s", passwd, userLogin.Passcode, md5Passwd, userLogin.Passwd)
if md5Passwd != userLogin.Passwd {
objLog.Infof("用户名 %q 填写的密码错误", username)
return nil, ErrPasswd
return nil, ErrUnameOrPwd
}

go func() {
Expand Down