Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 24df845

Browse files
committed
bugfix
1 parent 8783d40 commit 24df845

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/logic/user.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (self UserLogic) CreateUser(ctx context.Context, form url.Values) (errMsg s
7272
defer session.Close()
7373
session.Begin()
7474

75-
err = self.doCreateUser(ctx, session, user)
75+
err = self.doCreateUser(ctx, session, user, form.Get("passwd"))
7676
if err != nil {
7777
errMsg = "内部服务错误!"
7878
session.Rollback()
@@ -551,7 +551,7 @@ func (UserLogic) FindBindUsers(ctx context.Context, uid int) []*model.BindUser {
551551
return bindUsers
552552
}
553553

554-
func (UserLogic) doCreateUser(ctx context.Context, session *xorm.Session, user *model.User) error {
554+
func (UserLogic) doCreateUser(ctx context.Context, session *xorm.Session, user *model.User, passwd ...string) error {
555555

556556
if len(DefaultAvatars) > 0 {
557557
// 随机给一个默认头像
@@ -570,6 +570,9 @@ func (UserLogic) doCreateUser(ctx context.Context, session *xorm.Session, user *
570570
Username: user.Username,
571571
Uid: user.Uid,
572572
}
573+
if len(passwd) > 0 {
574+
userLogin.Passwd = passwd[0]
575+
}
573576

574577
if user.Status != model.UserStatusAudit {
575578
err = userLogin.GenMd5Passwd()

0 commit comments

Comments
 (0)