diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2014-04-11 10:28:23 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2014-04-11 10:28:23 +0800 |
commit | 8cfa2be4332abdc8bdcadead36d065eab3d2d55e (patch) | |
tree | 9fe6d03f5006c3dced1f9d5102f43504fb58e8b5 /routers/install.go | |
parent | db39e58a139ef8581b4b61d2d4a68b4e5324acdf (diff) | |
parent | 306aa5bffe7868207ed7b773c1aedbf3f0a659ad (diff) |
Merge branch 'dev' of github.com:gogits/gogs into dev
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") } |