1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-28 06:40:28 +08:00

add /api/setRole /api/disableUser

This commit is contained in:
源文雨
2023-03-21 13:56:45 +08:00
parent 0b166c6302
commit 7132aab796
8 changed files with 175 additions and 13 deletions

View File

@@ -24,6 +24,7 @@ var (
errEmptySalt = errors.New("empty salt")
errWrongPassword = errors.New("invalid username or password")
errTooManyFailedLogins = errors.New("too many failed logins")
errAccountIsDisabled = errors.New("account is disabled")
)
const (
@@ -119,6 +120,9 @@ func login(username, challenge string) (*loginResult, error) {
if err != nil {
return nil, err
}
if user.Pswd == "" {
return nil, errAccountIsDisabled
}
h := md5.New()
h.Write(base14.StringToBytes(user.Pswd))
h.Write(base14.StringToBytes(salt.Salt))