mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
Super code can be disabled
This commit is contained in:
parent
7ffe857f52
commit
d7ce455f2f
@ -706,6 +706,7 @@ demo:
|
|||||||
superCode: 666666 #超级验证码,建议修改掉,收不到短信验证码时可以用此替代
|
superCode: 666666 #超级验证码,建议修改掉,收不到短信验证码时可以用此替代
|
||||||
# second
|
# second
|
||||||
codeTTL: 60
|
codeTTL: 60
|
||||||
|
useSuperCode: true
|
||||||
mail: #仅支持qq邮箱,具体操作参考 https://service.mail.qq.com/cgi-bin/help?subtype=1&id=28&no=1001256 必须修改
|
mail: #仅支持qq邮箱,具体操作参考 https://service.mail.qq.com/cgi-bin/help?subtype=1&id=28&no=1001256 必须修改
|
||||||
title: "openIM"
|
title: "openIM"
|
||||||
senderMail: "765567899@qq.com"
|
senderMail: "765567899@qq.com"
|
||||||
|
@ -34,7 +34,8 @@ func ResetPassword(c *gin.Context) {
|
|||||||
} else {
|
} else {
|
||||||
account = req.PhoneNumber
|
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
|
accountKey := req.AreaCode + account + "_" + constant.VerificationCodeForResetSuffix
|
||||||
v, err := db.DB.GetAccountCode(accountKey)
|
v, err := db.DB.GetAccountCode(accountKey)
|
||||||
if err != nil || v != req.VerificationCode {
|
if err != nil || v != req.VerificationCode {
|
||||||
|
@ -46,7 +46,7 @@ func SetPassword(c *gin.Context) {
|
|||||||
if params.Nickname == "" {
|
if params.Nickname == "" {
|
||||||
params.Nickname = account
|
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
|
accountKey := params.AreaCode + account + "_" + constant.VerificationCodeForRegisterSuffix
|
||||||
v, err := db.DB.GetAccountCode(accountKey)
|
v, err := db.DB.GetAccountCode(accountKey)
|
||||||
if err != nil || v != params.VerificationCode {
|
if err != nil || v != params.VerificationCode {
|
||||||
|
@ -40,7 +40,7 @@ func Verify(c *gin.Context) {
|
|||||||
account = params.AreaCode + params.PhoneNumber
|
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)
|
log.NewInfo(params.OperationID, "Super Code Verified successfully", account)
|
||||||
data := make(map[string]interface{})
|
data := make(map[string]interface{})
|
||||||
data["account"] = account
|
data["account"] = account
|
||||||
|
@ -464,9 +464,10 @@ type config struct {
|
|||||||
VerificationCodeTemplateCode string `yaml:"verificationCodeTemplateCode"`
|
VerificationCodeTemplateCode string `yaml:"verificationCodeTemplateCode"`
|
||||||
Enable bool `yaml:"enable"`
|
Enable bool `yaml:"enable"`
|
||||||
}
|
}
|
||||||
SuperCode string `yaml:"superCode"`
|
SuperCode string `yaml:"superCode"`
|
||||||
CodeTTL int `yaml:"codeTTL"`
|
CodeTTL int `yaml:"codeTTL"`
|
||||||
Mail struct {
|
UseSuperCode bool `yaml:"useSuperCode"`
|
||||||
|
Mail struct {
|
||||||
Title string `yaml:"title"`
|
Title string `yaml:"title"`
|
||||||
SenderMail string `yaml:"senderMail"`
|
SenderMail string `yaml:"senderMail"`
|
||||||
SenderAuthorizationCode string `yaml:"senderAuthorizationCode"`
|
SenderAuthorizationCode string `yaml:"senderAuthorizationCode"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user