feat: make used bcrypt rounds configurable

This allows to configure the used bcrypt rounds and set it to 4 in tests, greatly speeding up the tests. It's not really required to set this to another value but it might be in the future as computers get faster.
This commit is contained in:
kolaente
2024-10-13 15:38:04 +02:00
parent e22fb1e73e
commit a88124cfce
17 changed files with 69 additions and 59 deletions

View File

@@ -119,7 +119,7 @@ func CreateUser(s *xorm.Session, user *User) (newUser *User, err error) {
// HashPassword hashes a password
func HashPassword(password string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(password), 11)
bytes, err := bcrypt.GenerateFromPassword([]byte(password), config.ServiceBcryptRounds.GetInt())
return string(bytes), err
}