From f1130ce5e9fa63df5e472a9c5fbd3e875f1ba9f5 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 12 May 2014 11:02:36 -0400 Subject: [PATCH] Fix edit auth page bug --- README.md | 3 ++- README_ZH.md | 3 ++- models/login.go | 7 ++++-- modules/auth/authentication.go | 2 ++ routers/admin/auths.go | 8 +++---- templates/admin/auths/edit.tmpl | 41 ++++++++++++++++++--------------- templates/admin/auths/new.tmpl | 8 +++---- 7 files changed, 41 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 7e903abd5d..a43be6f36f 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,11 @@ More importantly, Gogs only needs one binary to setup your own project hosting o Make sure you install [Prerequirements](http://gogs.io/docs/installation/) first. -There are 4 ways to install Gogs: +There are 5 ways to install Gogs: - [Install from binary](http://gogs.io/docs/installation/install_from_binary.md): **STRONGLY RECOMMENDED** - [Install from source](http://gogs.io/docs/installation/install_from_source.md) +- [Install from packages](http://gogs.io/docs/installation/install_from_packages.md) - [Ship with Docker](https://github.com/gogits/gogs/tree/master/dockerfiles) - [Install with Vagrant](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs) diff --git a/README_ZH.md b/README_ZH.md index d1f742d44d..05797b9634 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -44,10 +44,11 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依 在安装 Gogs 之前,您需要先安装 [基本环境](http://gogs.io/docs/installation/)。 -然后,您可以通过以下 4 种方式来安装 Gogs: +然后,您可以通过以下 5 种方式来安装 Gogs: - [二进制安装](http://gogs.io/docs/installation/install_from_binary.md): **强烈推荐** - [源码安装](http://gogs.io/docs/installation/install_from_source.md) +- [包管理安装](http://gogs.io/docs/installation/install_from_packages.md) - [采用 Docker 部署](https://github.com/gogits/gogs/tree/master/dockerfiles) - [通过 Vagrant 安装](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs) diff --git a/models/login.go b/models/login.go index 313880df53..be185488ac 100644 --- a/models/login.go +++ b/models/login.go @@ -37,8 +37,11 @@ var LoginTypes = map[int]string{ LT_SMTP: "SMTP", } -var _ core.Conversion = &LDAPConfig{} -var _ core.Conversion = &SMTPConfig{} +// Ensure structs implmented interface. +var ( + _ core.Conversion = &LDAPConfig{} + _ core.Conversion = &SMTPConfig{} +) type LDAPConfig struct { ldap.Ldapsource diff --git a/modules/auth/authentication.go b/modules/auth/authentication.go index 4456d2a5f7..170b24a988 100644 --- a/modules/auth/authentication.go +++ b/modules/auth/authentication.go @@ -27,6 +27,8 @@ type AuthenticationForm struct { MsAdSA string `form:"ms_ad_sa"` IsActived bool `form:"is_actived"` SmtpAuth string `form:"smtpauth"` + SmtpHost string `form:"smtphost"` + SmtpPort int `form:"smtpport"` Tls bool `form:"tls"` AllowAutoRegister bool `form:"allowautoregister"` } diff --git a/routers/admin/auths.go b/routers/admin/auths.go index 1822fd69ae..0bc2566a1c 100644 --- a/routers/admin/auths.go +++ b/routers/admin/auths.go @@ -55,8 +55,8 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { case models.LT_SMTP: u = &models.SMTPConfig{ Auth: form.SmtpAuth, - Host: form.Host, - Port: form.Port, + Host: form.SmtpHost, + Port: form.SmtpPort, TLS: form.Tls, } default: @@ -132,8 +132,8 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { case models.LT_SMTP: config = &models.SMTPConfig{ Auth: form.SmtpAuth, - Host: form.Host, - Port: form.Port, + Host: form.SmtpHost, + Port: form.SmtpPort, TLS: form.Tls, } default: diff --git a/templates/admin/auths/edit.tmpl b/templates/admin/auths/edit.tmpl index 2c7a5754bf..b3277242ce 100644 --- a/templates/admin/auths/edit.tmpl +++ b/templates/admin/auths/edit.tmpl @@ -18,11 +18,11 @@
-
- {{range $key, $val := .LoginTypes}} - {{if eq $key $type}}{{$val}}{{end}} - {{end}} -
+
@@ -85,46 +85,47 @@
-
+
-
+
-
+ {{end}} - -
- -
- -
-
+
+
+ +
+
+
+
+
diff --git a/templates/admin/auths/new.tmpl b/templates/admin/auths/new.tmpl index e5dcb4339b..3741d9cc5f 100644 --- a/templates/admin/auths/new.tmpl +++ b/templates/admin/auths/new.tmpl @@ -93,17 +93,17 @@
-
+
- +
-
+
- +