update user only if it exists
This commit is contained in:
parent
972f38fe6a
commit
d8eece9046
|
|
@ -362,6 +362,14 @@ func updateUser(username, password string) {
|
|||
conn := globalPool.Get()
|
||||
defer conn.Close()
|
||||
logit("updateUser: " + username)
|
||||
|
||||
// we exit if user does not exit
|
||||
exists, _ := redis.Bool(conn.Do("EXISTS", userPrefix+username))
|
||||
if !exists {
|
||||
logit("updateUser: User does not exist: " + username)
|
||||
return
|
||||
}
|
||||
|
||||
pwd := []byte(password)
|
||||
hashedPassword, err := bcrypt.GenerateFromPassword(pwd, bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue