diff options
Diffstat (limited to 'routers/install.go')
-rw-r--r-- | routers/install.go | 70 |
1 files changed, 39 insertions, 31 deletions
diff --git a/routers/install.go b/routers/install.go index 5d6c65ef..78ba383d 100644 --- a/routers/install.go +++ b/routers/install.go @@ -63,42 +63,49 @@ func Install(ctx *middleware.Context, form auth.InstallForm) { ctx.Data["Title"] = "Install" ctx.Data["PageIsInstall"] = true - if ctx.Req.Method == "GET" { - // Get and assign value to install form. - if len(form.Host) == 0 { - form.Host = models.DbCfg.Host - } - if len(form.User) == 0 { - form.User = models.DbCfg.User - } - if len(form.Passwd) == 0 { - form.Passwd = models.DbCfg.Pwd - } - if len(form.DatabaseName) == 0 { - form.DatabaseName = models.DbCfg.Name - } - if len(form.DatabasePath) == 0 { - form.DatabasePath = models.DbCfg.Path - } + // Get and assign value to install form. + if len(form.Host) == 0 { + form.Host = models.DbCfg.Host + } + if len(form.User) == 0 { + form.User = models.DbCfg.User + } + if len(form.Passwd) == 0 { + form.Passwd = models.DbCfg.Pwd + } + if len(form.DatabaseName) == 0 { + form.DatabaseName = models.DbCfg.Name + } + if len(form.DatabasePath) == 0 { + form.DatabasePath = models.DbCfg.Path + } - if len(form.RepoRootPath) == 0 { - form.RepoRootPath = base.RepoRootPath - } - if len(form.RunUser) == 0 { - form.RunUser = base.RunUser - } - if len(form.Domain) == 0 { - form.Domain = base.Domain - } - if len(form.AppUrl) == 0 { - form.AppUrl = base.AppUrl - } + if len(form.RepoRootPath) == 0 { + form.RepoRootPath = base.RepoRootPath + } + if len(form.RunUser) == 0 { + form.RunUser = base.RunUser + } + if len(form.Domain) == 0 { + form.Domain = base.Domain + } + if len(form.AppUrl) == 0 { + form.AppUrl = base.AppUrl + } - auth.AssignForm(form, ctx.Data) - ctx.HTML(200, "install") + auth.AssignForm(form, ctx.Data) + ctx.HTML(200, "install") +} + +func InstallPost(ctx *middleware.Context, form auth.InstallForm) { + if base.InstallLock { + ctx.Handle(404, "install.Install", errors.New("Installation is prohibited")) return } + ctx.Data["Title"] = "Install" + ctx.Data["PageIsInstall"] = true + if ctx.HasError() { ctx.HTML(200, "install") return @@ -197,5 +204,6 @@ func Install(ctx *middleware.Context, form auth.InstallForm) { } log.Info("First-time run install finished!") + ctx.Flash.Success("Welcome! We're glad that you choose Gogs, have fun and take care.") ctx.Redirect("/user/login") } |