summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/admin/user.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-01-10 19:05:18 +0100
committerGitHub <noreply@github.com>2021-01-10 20:05:18 +0200
commit74a0481586b7035bbe7a82f6e7e275cdd87d382a (patch)
tree1e0a0c40619529bcc2c32ceaf007fafc0f565dfd /routers/api/v1/admin/user.go
parent6b3b6f1833d07383d24d68ec220a18315ac36809 (diff)
downloadgitea-74a0481586b7035bbe7a82f6e7e275cdd87d382a.tar.gz
gitea-74a0481586b7035bbe7a82f6e7e275cdd87d382a.zip
[Refactor] Passwort Hash/Set (#14282)
* move SaltGeneration into HashPasswort and rename it to what it does * Migration: Where Password is Valid with Empty String delete it * prohibit empty password hash * let SetPassword("") unset pwd stuff
Diffstat (limited to 'routers/api/v1/admin/user.go')
-rw-r--r--routers/api/v1/admin/user.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go
index 93b28c2175..670baf020b 100644
--- a/routers/api/v1/admin/user.go
+++ b/routers/api/v1/admin/user.go
@@ -174,7 +174,10 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
ctx.Error(http.StatusInternalServerError, "UpdateUser", err)
return
}
- u.HashPassword(form.Password)
+ if err = u.SetPassword(form.Password); err != nil {
+ ctx.InternalServerError(err)
+ return
+ }
}
if form.MustChangePassword != nil {