From d96f2a71849ed312c3c69177f1cb7b4a174421da Mon Sep 17 00:00:00 2001 From: leonklingele Date: Wed, 21 Dec 2016 09:41:37 +0100 Subject: Fix random string generator (#3953) * Remove unused custom-alphabet feature of random string generator * Fix modulo-biased random string generator * Random string generator should return error if it fails to read random data via crypto/rand --- routers/admin/users.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'routers/admin/users.go') diff --git a/routers/admin/users.go b/routers/admin/users.go index eb91ea2f..6841da1f 100644 --- a/routers/admin/users.go +++ b/routers/admin/users.go @@ -192,7 +192,11 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) { 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.Handle(500, "UpdateUser", err) + return + } u.EncodePasswd() } -- cgit v1.2.3