mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
fix code
This commit is contained in:
parent
4e54cb56e5
commit
15e2d172a4
@ -162,7 +162,16 @@ func AddUserIPLimitLogin(c *gin.Context) {
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req:", req)
|
||||
userIp := db.UserIpLimit{UserID: req.UserID, Ip: req.IP}
|
||||
err := imdb.InsertUserIpLimitsLogin(&userIp)
|
||||
err := imdb.UpdateUserInfo(db.User{
|
||||
UserID: req.UserID,
|
||||
LoginLimit: 1,
|
||||
})
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.UserID)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": constant.ErrDB, "errMsg": "InsertUserIpLimitsLogin error!"})
|
||||
return
|
||||
}
|
||||
err = imdb.InsertUserIpLimitsLogin(&userIp)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.UserID)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": constant.ErrDB, "errMsg": "InsertUserIpLimitsLogin error!"})
|
||||
|
@ -81,10 +81,11 @@ func SetPassword(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if config.Config.Demo.NeedInvitationCode {
|
||||
if config.Config.Demo.NeedInvitationCode && params.InvitationCode != "" {
|
||||
err := imdb.CheckInvitationCode(params.InvitationCode)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": constant.InvitationError, "errMsg": "邀请码错误"})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,7 +143,7 @@ func SetPassword(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": constant.RegisterFailed, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
if config.Config.Demo.NeedInvitationCode {
|
||||
if config.Config.Demo.NeedInvitationCode && params.InvitationCode != "" {
|
||||
//判断一下验证码的使用情况
|
||||
LockSucc := imdb.TryLockInvitationCode(params.InvitationCode, userID)
|
||||
if LockSucc {
|
||||
|
Loading…
x
Reference in New Issue
Block a user