feat: allow disabling password check for delegated authentication

This commit is contained in:
Henrique Dias
2024-08-01 21:53:58 +02:00
parent 373b2ec931
commit d3bee98000
5 changed files with 56 additions and 7 deletions
+2 -2
View File
@@ -24,12 +24,12 @@ func (u User) checkPassword(input string) bool {
return u.Password == input
}
func (u *User) Validate() error {
func (u *User) Validate(noPassword bool) error {
if u.Username == "" {
return errors.New("invalid user: username must be set")
}
if u.Password == "" {
if u.Password == "" && !noPassword {
return fmt.Errorf("invalid user %q: password must be set", u.Username)
} else if strings.HasPrefix(u.Password, "{env}") {