mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 02:55:58 +08:00
add reset pwd
This commit is contained in:
@@ -3,11 +3,13 @@ package db
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
log2 "Open_IM/pkg/common/log"
|
||||
"fmt"
|
||||
"github.com/garyburd/redigo/redis"
|
||||
)
|
||||
|
||||
const (
|
||||
registerAccountTempCode = "REGISTER_ACCOUNT_TEMP_CODE"
|
||||
AccountTempCode = "ACCOUNT_TEMP_CODE"
|
||||
resetPwdTempCode = "RESET_PWD_TEMP_CODE"
|
||||
userIncrSeq = "REDIS_USER_INCR_SEQ:" // user incr seq
|
||||
appleDeviceToken = "DEVICE_TOKEN"
|
||||
userMinSeq = "REDIS_USER_MIN_SEQ:"
|
||||
@@ -35,19 +37,21 @@ func (d *DataBases) Exec(cmd string, key interface{}, args ...interface{}) (inte
|
||||
return con.Do(cmd, params...)
|
||||
}
|
||||
func (d *DataBases) JudgeAccountEXISTS(account string) (bool, error) {
|
||||
key := registerAccountTempCode + account
|
||||
key := AccountTempCode + account
|
||||
return redis.Bool(d.Exec("EXISTS", key))
|
||||
}
|
||||
func (d *DataBases) SetAccountCode(account string, code, ttl int) (err error) {
|
||||
key := registerAccountTempCode + account
|
||||
_, err = d.Exec("Set", key, code, ttl)
|
||||
key := AccountTempCode + account
|
||||
_, err = d.Exec("SET", key, code)
|
||||
return err
|
||||
}
|
||||
func (d *DataBases) GetAccountCode(account string) (string, error) {
|
||||
key := userIncrSeq + account
|
||||
key := AccountTempCode + account
|
||||
fmt.Println(key)
|
||||
return redis.String(d.Exec("GET", key))
|
||||
}
|
||||
|
||||
|
||||
//Perform seq auto-increment operation of user messages
|
||||
func (d *DataBases) IncrUserSeq(uid string) (uint64, error) {
|
||||
key := userIncrSeq + uid
|
||||
|
||||
Reference in New Issue
Block a user