mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-12 04:55:59 +08:00
fix reset password api
This commit is contained in:
@@ -21,7 +21,7 @@ type paramsVerificationCode struct {
|
||||
Email string `json:"email"`
|
||||
PhoneNumber string `json:"phoneNumber"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UsedFor int `json:"usedFor" binding:"required"`
|
||||
UsedFor int `json:"usedFor"`
|
||||
}
|
||||
|
||||
func SendVerificationCode(c *gin.Context) {
|
||||
@@ -38,6 +38,9 @@ func SendVerificationCode(c *gin.Context) {
|
||||
account = params.PhoneNumber
|
||||
}
|
||||
var accountKey string
|
||||
if params.UsedFor == 0 {
|
||||
params.UsedFor = constant.VerificationCodeForRegister
|
||||
}
|
||||
switch params.UsedFor {
|
||||
case constant.VerificationCodeForRegister:
|
||||
_, err := im_mysql_model.GetRegister(account)
|
||||
|
||||
@@ -15,7 +15,7 @@ type paramsCertification struct {
|
||||
PhoneNumber string `json:"phoneNumber"`
|
||||
VerificationCode string `json:"verificationCode"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UsedFor int `json:"usedFor" binding:"required"`
|
||||
UsedFor int `json:"usedFor"`
|
||||
}
|
||||
|
||||
func Verify(c *gin.Context) {
|
||||
@@ -44,8 +44,11 @@ func Verify(c *gin.Context) {
|
||||
}
|
||||
log.NewInfo("0", " params.VerificationCode != config.Config.Demo.SuperCode", params.VerificationCode, config.Config.Demo)
|
||||
log.NewInfo(params.OperationID, "begin get form redis", account)
|
||||
|
||||
code, err := db.DB.GetAccountCode(account)
|
||||
if params.UsedFor == 0 {
|
||||
params.UsedFor = 1
|
||||
}
|
||||
accountKey := account + "_" + constant.VerificationCodeForResetSuffix
|
||||
code, err := db.DB.GetAccountCode(accountKey)
|
||||
log.NewInfo(params.OperationID, "redis phone number and verificating Code", account, code)
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, "Verification code expired", account, "err", err.Error())
|
||||
|
||||
Reference in New Issue
Block a user