diff options
Diffstat (limited to 'routers/install.go')
-rw-r--r-- | routers/install.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/routers/install.go b/routers/install.go index 35728c3ca9..36293b1030 100644 --- a/routers/install.go +++ b/routers/install.go @@ -345,7 +345,12 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) { cfg.Section("security").Key("INSTALL_LOCK").SetValue("true") cfg.Section("security").Key("SECRET_KEY").SetValue(base.GetRandomString(15)) - os.MkdirAll(filepath.Dir(setting.CustomConf), os.ModePerm) + err := os.MkdirAll(filepath.Dir(setting.CustomConf), os.ModePerm) + if err != nil { + ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form) + return + } + if err := cfg.SaveTo(setting.CustomConf); err != nil { ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form) return @@ -375,8 +380,14 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) { } // Auto-login for admin - ctx.Session.Set("uid", u.ID) - ctx.Session.Set("uname", u.Name) + if err := ctx.Session.Set("uid", u.ID); err != nil { + ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form) + return + } + if err := ctx.Session.Set("uname", u.Name); err != nil { + ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form) + return + } } log.Info("First-time run install finished!") |