summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-04-26 22:34:48 -0600
committerUnknown <joe2010xtmf@163.com>2014-04-26 22:34:48 -0600
commit59d0e73c3507296b31c8e741b44afc7bfe1eb695 (patch)
tree79970b755e0c5309b0f05dcd45053f91500ba85b /routers
parent1badb2bbccfe81303f69f8dedf57c22fb89d4b99 (diff)
downloadgitea-59d0e73c3507296b31c8e741b44afc7bfe1eb695.tar.gz
gitea-59d0e73c3507296b31c8e741b44afc7bfe1eb695.zip
Batch mirror fix
Diffstat (limited to 'routers')
-rw-r--r--routers/install.go16
-rw-r--r--routers/user/user.go8
2 files changed, 20 insertions, 4 deletions
diff --git a/routers/install.go b/routers/install.go
index 12182ad300..8ffa9b5d1a 100644
--- a/routers/install.go
+++ b/routers/install.go
@@ -65,6 +65,10 @@ func GlobalInit() {
checkRunMode()
}
+func renderDbOption(ctx *middleware.Context) {
+ ctx.Data["DbOptions"] = []string{"MySQL", "PostgreSQL", "SQLite3"}
+}
+
func Install(ctx *middleware.Context, form auth.InstallForm) {
if base.InstallLock {
ctx.Handle(404, "install.Install", errors.New("Installation is prohibited"))
@@ -104,6 +108,13 @@ func Install(ctx *middleware.Context, form auth.InstallForm) {
form.AppUrl = base.AppUrl
}
+ renderDbOption(ctx)
+ curDbValue := ""
+ if models.EnableSQLite3 {
+ curDbValue = "SQLite3" // Default when enabled.
+ }
+ ctx.Data["CurDbValue"] = curDbValue
+
auth.AssignForm(form, ctx.Data)
ctx.HTML(200, "install")
}
@@ -117,6 +128,9 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
ctx.Data["Title"] = "Install"
ctx.Data["PageIsInstall"] = true
+ renderDbOption(ctx)
+ ctx.Data["CurDbValue"] = form.Database
+
if ctx.HasError() {
ctx.HTML(200, "install")
return
@@ -129,7 +143,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
// Pass basic check, now test configuration.
// Test database setting.
- dbTypes := map[string]string{"mysql": "mysql", "pgsql": "postgres", "sqlite": "sqlite3"}
+ dbTypes := map[string]string{"MySQL": "mysql", "PostgreSQL": "postgres", "SQLite3": "sqlite3"}
models.DbCfg.Type = dbTypes[form.Database]
models.DbCfg.Host = form.Host
models.DbCfg.User = form.User
diff --git a/routers/user/user.go b/routers/user/user.go
index 75314237dd..fe53896e41 100644
--- a/routers/user/user.go
+++ b/routers/user/user.go
@@ -91,12 +91,14 @@ func SignInPost(ctx *middleware.Context, form auth.LogInForm) {
var user *models.User
var err error
- // try to login against LDAP if defined
- if base.LdapAuth {
+ if base.Service.LdapAuth {
user, err = models.LoginUserLdap(form.UserName, form.Password)
+ if err != nil {
+ log.Error("Fail to login through LDAP: %v", err)
+ }
}
// try local if not LDAP or it's failed
- if (!base.LdapAuth) || (err != nil) {
+ if !base.Service.LdapAuth || err != nil {
user, err = models.LoginUserPlain(form.UserName, form.Password)
}
if err != nil {