initialize argon params before creating the data provider

This commit is contained in:
Nicola Murino 2021-03-21 20:22:17 +01:00
parent df2e490680
commit dd485509f6
No known key found for this signature in database
GPG key ID: 2F1FB59433D5A8CB

View file

@ -469,6 +469,13 @@ func Initialize(cnf Config, basePath string, checkAdmins bool) error {
} else {
credentialsDirPath = filepath.Join(basePath, config.CredentialsPath)
}
argon2Params = &argon2id.Params{
Memory: cnf.PasswordHashing.Argon2Options.Memory,
Iterations: cnf.PasswordHashing.Argon2Options.Iterations,
Parallelism: cnf.PasswordHashing.Argon2Options.Parallelism,
SaltLength: 16,
KeyLength: 32,
}
if err = validateHooks(); err != nil {
return err
@ -477,13 +484,6 @@ func Initialize(cnf Config, basePath string, checkAdmins bool) error {
if err != nil {
return err
}
argon2Params = &argon2id.Params{
Memory: cnf.PasswordHashing.Argon2Options.Memory,
Iterations: cnf.PasswordHashing.Argon2Options.Iterations,
Parallelism: cnf.PasswordHashing.Argon2Options.Parallelism,
SaltLength: 16,
KeyLength: 32,
}
if cnf.UpdateMode == 0 {
err = provider.initializeDatabase()
if err != nil && err != ErrNoInitRequired {