Skip to content

Commit acc0757

Browse files
authored
Merge pull request #15 from MuShare/fix/wechat
Fix wechat binding
2 parents e467240 + 53af002 commit acc0757

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

manage/user.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,15 @@ func (m *Manager) WechatLoginMobile(login request.WechatMobileLogin) (*GrantResu
405405
if perr != nil {
406406
return nil, perr
407407
}
408-
wechatBinding, perr = m.newBinding(tx, user.ID, "", WECHATLOGIN, info.Unionid, true)
408+
wechatBinding, perr = m.newBinding(tx, user.ID, info.Nickname, WECHATLOGIN, info.Unionid, true)
409409
if perr != nil {
410410
return nil, perr
411411
}
412412
} else {
413+
wechatBinding.Mail = info.Nickname
414+
if _, err := wechatBinding.Update(tx, boil.Whitelist("mail")); err != nil {
415+
return nil, perror.ServerError.Wrapper(err)
416+
}
413417
user, err = models.Users(qm.Where("id = ?", wechatBinding.UserID)).One(tx)
414418
if err != nil {
415419
return nil, perror.ServerError.Wrapper(err)
@@ -1274,7 +1278,7 @@ func (m *Manager) BindWechat(binding *request.Binding, accessPayload *jwt.Access
12741278
return perror.BindAlreadyExists
12751279
}
12761280

1277-
_, perr = m.newBinding(tx, accessPayload.UserID, "", WECHATLOGIN, identifyToken, true)
1281+
_, perr = m.newBinding(tx, accessPayload.UserID, info.Nickname, WECHATLOGIN, identifyToken, true)
12781282
if perr != nil {
12791283
return perr
12801284
}

0 commit comments

Comments
 (0)