mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 14:00:04 +02:00
Fix random string generator (#384)
* Remove unused custom-alphabet feature of random string generator Fix random string generator Random string generator should return error if it fails to read random data via crypto/rand * Fixes variable (un)initialization mixed assign Update test GetRandomString
This commit is contained in:
parent
952587dbae
commit
380e32e129
11 changed files with 94 additions and 35 deletions
|
@ -87,7 +87,11 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
|
|||
|
||||
if len(form.Password) > 0 {
|
||||
u.Passwd = form.Password
|
||||
u.Salt = models.GetUserSalt()
|
||||
var err error
|
||||
if u.Salt, err = models.GetUserSalt(); err != nil {
|
||||
ctx.Error(500, "UpdateUser", err)
|
||||
return
|
||||
}
|
||||
u.EncodePasswd()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue