small bug fix

This commit is contained in:
ston1th 2018-10-27 21:41:23 +02:00
commit d362159693
2 changed files with 9 additions and 6 deletions

View file

@ -168,6 +168,9 @@ func (db *DB) UpdateUserSecret(username, secret string) error {
}
func (db *DB) UpdateUserPassword(username, password string) error {
if password == "" {
return errors.New("empty password")
}
u, err := db.GetUser(username)
if err != nil {
return err

View file

@ -507,14 +507,14 @@ func userEditHandler(ctx *Context) {
Title: "Edit User",
BodyTitle: "Edit User",
}
switch ctx.Method() {
case "GET":
u, err := ctx.Srv.DB.GetUserWithoutPassword(ctx.Var("user"))
if err != nil {
ctx.Error(err)
return
}
ctx.Data.Data = u
switch ctx.Method() {
case "GET":
ctx.Exec()
case "POST":
if !ctx.CheckXsrf() {