better search view and admin user reset

This commit is contained in:
ston1th 2019-06-11 19:56:08 +02:00
commit 4812a60367
7 changed files with 54 additions and 14 deletions

View file

@ -185,6 +185,10 @@ func (db *DB) UpdateUserPassword(username, password string) error {
return db.store.Set(userPrefix+username, u)
}
func (db *DB) ResetAdmin() error {
return db.UpdateUserPassword(defUser, defPassword)
}
func (db *DB) AdminUpdateUser(username, password string, admin bool) error {
if username == defUser && !admin {
return errors.New("user '" + defUser + "' cannot lose admin privileges")