chore: init users

This commit is contained in:
Noah Hsu
2022-06-25 22:05:02 +08:00
parent b474eefd87
commit 54ca68e4b3
7 changed files with 88 additions and 12 deletions

View File

@ -1,6 +1,9 @@
package model
import "github.com/pkg/errors"
import (
"github.com/alist-org/alist/v3/internal/errs"
"github.com/pkg/errors"
)
const (
GENERAL = iota
@ -27,10 +30,10 @@ func (u User) IsAdmin() bool {
func (u User) ValidatePassword(password string) error {
if password == "" {
return errors.New("password is empty")
return errors.WithStack(errs.EmptyPassword)
}
if u.Password != password {
return errors.New("password is incorrect")
return errors.WithStack(errs.WrongPassword)
}
return nil
}