fix(autobrrctl): prevent empty password (#1468)

* fix(autobrrctl): prevent empty password

* fix(autobrrctl): prevent empty password for create-user aswell
fix(autobrrctl): stringify password in checks

* feat(autobrrctl): validate password length

---------

Co-authored-by: ze0s <ze0s@riseup.net>
This commit is contained in:
martylukyy 2024-03-24 10:39:51 +01:00 committed by GitHub
parent 65b42f517d
commit 2337ee4d75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 13 deletions

View file

@ -154,5 +154,9 @@ func (s *service) ComparePasswordAndHash(password string, hash string) (match bo
}
func (s *service) CreateHash(password string) (hash string, err error) {
if password == "" {
return "", errors.New("must supply non empty password to CreateHash")
}
return argon2id.CreateHash(password, argon2id.DefaultParams)
}