mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-11 04:25:59 +08:00
Super code can be disabled
This commit is contained in:
@@ -34,7 +34,8 @@ func ResetPassword(c *gin.Context) {
|
||||
} else {
|
||||
account = req.PhoneNumber
|
||||
}
|
||||
if req.VerificationCode != config.Config.Demo.SuperCode {
|
||||
|
||||
if (config.Config.Demo.UseSuperCode && req.VerificationCode != config.Config.Demo.SuperCode) || !config.Config.Demo.UseSuperCode {
|
||||
accountKey := req.AreaCode + account + "_" + constant.VerificationCodeForResetSuffix
|
||||
v, err := db.DB.GetAccountCode(accountKey)
|
||||
if err != nil || v != req.VerificationCode {
|
||||
|
||||
@@ -46,7 +46,7 @@ func SetPassword(c *gin.Context) {
|
||||
if params.Nickname == "" {
|
||||
params.Nickname = account
|
||||
}
|
||||
if params.VerificationCode != config.Config.Demo.SuperCode {
|
||||
if (config.Config.Demo.UseSuperCode && params.VerificationCode != config.Config.Demo.SuperCode) || !config.Config.Demo.UseSuperCode {
|
||||
accountKey := params.AreaCode + account + "_" + constant.VerificationCodeForRegisterSuffix
|
||||
v, err := db.DB.GetAccountCode(accountKey)
|
||||
if err != nil || v != params.VerificationCode {
|
||||
|
||||
@@ -40,7 +40,7 @@ func Verify(c *gin.Context) {
|
||||
account = params.AreaCode + params.PhoneNumber
|
||||
}
|
||||
|
||||
if params.VerificationCode == config.Config.Demo.SuperCode {
|
||||
if config.Config.Demo.UseSuperCode && params.VerificationCode == config.Config.Demo.SuperCode {
|
||||
log.NewInfo(params.OperationID, "Super Code Verified successfully", account)
|
||||
data := make(map[string]interface{})
|
||||
data["account"] = account
|
||||
|
||||
Reference in New Issue
Block a user