summaryrefslogtreecommitdiffstats
path: root/routers/admin/auths.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-11 10:37:31 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-11 10:37:31 -0400
commit2c73ced0db2a3dc0402dc0cdc78538370bbf9e71 (patch)
treee292a8d87b66ab31a00b1b2a115f071370d1d4ab /routers/admin/auths.go
parentf68e279150b8c58a0c5ffeea44fe1a613031e58b (diff)
downloadgitea-2c73ced0db2a3dc0402dc0cdc78538370bbf9e71.tar.gz
gitea-2c73ced0db2a3dc0402dc0cdc78538370bbf9e71.zip
Fix #173
Diffstat (limited to 'routers/admin/auths.go')
-rw-r--r--routers/admin/auths.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/routers/admin/auths.go b/routers/admin/auths.go
index 495acefda9..1822fd69ae 100644
--- a/routers/admin/auths.go
+++ b/routers/admin/auths.go
@@ -9,6 +9,7 @@ import (
"github.com/go-martini/martini"
"github.com/go-xorm/core"
+
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/auth/ldap"
@@ -114,7 +115,8 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
}
var config core.Conversion
- if form.Type == models.LT_LDAP {
+ switch form.Type {
+ case models.LT_LDAP:
config = &models.LDAPConfig{
Ldapsource: ldap.Ldapsource{
Host: form.Host,
@@ -127,13 +129,16 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
Name: form.AuthName,
},
}
- } else if form.Type == models.LT_SMTP {
+ case models.LT_SMTP:
config = &models.SMTPConfig{
Auth: form.SmtpAuth,
Host: form.Host,
Port: form.Port,
TLS: form.Tls,
}
+ default:
+ ctx.Error(400)
+ return
}
u := models.LoginSource{
@@ -145,10 +150,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
}
if err := models.UpdateSource(&u); err != nil {
- switch err {
- default:
- ctx.Handle(500, "admin.auths.EditAuth", err)
- }
+ ctx.Handle(500, "admin.auths.EditAuth", err)
return
}