aboutsummaryrefslogtreecommitdiff
path: root/routers/admin
diff options
context:
space:
mode:
authorleonklingele <git@leonklingele.de>2016-12-21 09:41:37 +0100
committer无闻 <u@gogs.io>2016-12-21 03:41:37 -0500
commitd96f2a71849ed312c3c69177f1cb7b4a174421da (patch)
tree8d68aa9631801722ecaeab3d2089bb2a922794b6 /routers/admin
parentadcb1d7c651720d71efea238e011582b9e455c2d (diff)
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
Diffstat (limited to 'routers/admin')
1 files changed, 5 insertions, 1 deletions
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()
}