diff options
author | zeripath <art27@cantab.net> | 2021-02-16 22:37:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 23:37:20 +0100 |
commit | ad43b119a847fbb05d22caefa2602696773bb229 (patch) | |
tree | ac8d2f71ef6fa23a41e93236f673d59f96aee48f /routers | |
parent | 66a148e398c3c944e2b79187c09ef0bb7bdfdd5e (diff) | |
download | gitea-ad43b119a847fbb05d22caefa2602696773bb229.tar.gz gitea-ad43b119a847fbb05d22caefa2602696773bb229.zip |
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>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/install.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/routers/install.go b/routers/install.go index 69ae428a54..cfe5582f2b 100644 --- a/routers/install.go +++ b/routers/install.go @@ -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 { |