Add Password Algorithm option to install page (#14701)
Add Password Algorithm option to install page Fix #14674 Co-authored-by: John Olheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
66a148e398
commit
ad43b119a8
5 changed files with 36 additions and 1 deletions
|
@ -66,6 +66,7 @@ func InstallInit(next http.Handler) http.Handler {
|
|||
"TmplLoadTimes": func() string {
|
||||
return time.Since(startTime).String()
|
||||
},
|
||||
"PasswordHashAlgorithms": models.AvailableHashAlgorithms,
|
||||
},
|
||||
}
|
||||
ctx.Req = context.WithContext(req, &ctx)
|
||||
|
@ -142,6 +143,7 @@ func Install(ctx *context.Context) {
|
|||
form.DefaultAllowCreateOrganization = setting.Service.DefaultAllowCreateOrganization
|
||||
form.DefaultEnableTimetracking = setting.Service.DefaultEnableTimetracking
|
||||
form.NoReplyAddress = setting.Service.NoReplyAddress
|
||||
form.PasswordAlgorithm = setting.PasswordHashAlgo
|
||||
|
||||
middleware.AssignForm(form, ctx.Data)
|
||||
ctx.HTML(200, tplInstall)
|
||||
|
@ -185,6 +187,8 @@ func InstallPost(ctx *context.Context) {
|
|||
setting.Database.Charset = form.Charset
|
||||
setting.Database.Path = form.DbPath
|
||||
|
||||
setting.PasswordHashAlgo = form.PasswordAlgorithm
|
||||
|
||||
if (setting.Database.Type == "sqlite3") &&
|
||||
len(setting.Database.Path) == 0 {
|
||||
ctx.Data["Err_DbPath"] = true
|
||||
|
@ -380,6 +384,9 @@ func InstallPost(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
cfg.Section("security").Key("SECRET_KEY").SetValue(secretKey)
|
||||
if len(form.PasswordAlgorithm) > 0 {
|
||||
cfg.Section("security").Key("PASSWORD_HASH_ALGO").SetValue(form.PasswordAlgorithm)
|
||||
}
|
||||
|
||||
err = os.MkdirAll(filepath.Dir(setting.CustomConf), os.ModePerm)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue