From 380e32e129d7a8868b9853e92e208a97e3ac125f Mon Sep 17 00:00:00 2001 From: Denis Denisov Date: Tue, 20 Dec 2016 14:32:02 +0200 Subject: 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 --- routers/admin/users.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'routers/admin') diff --git a/routers/admin/users.go b/routers/admin/users.go index c95aba7729..fa61a46938 100644 --- a/routers/admin/users.go +++ b/routers/admin/users.go @@ -197,7 +197,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