summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-29 15:45:58 +0800
committerUnknwon <u@gogs.io>2015-08-29 15:45:58 +0800
commitea454c21f776a0fd4f7d3a64218bea6e743e5dce (patch)
tree5c2b6e55a0cf9e6cf9b7bc21a1437a1bc7ab5655 /routers
parent384fbeca801180c2f156e916bf69324590472e03 (diff)
downloadgitea-ea454c21f776a0fd4f7d3a64218bea6e743e5dce.tar.gz
gitea-ea454c21f776a0fd4f7d3a64218bea6e743e5dce.zip
#1542 A way to skip TLS verify for SMTP authentication
Diffstat (limited to 'routers')
-rw-r--r--routers/admin/auths.go76
1 files changed, 39 insertions, 37 deletions
diff --git a/routers/admin/auths.go b/routers/admin/auths.go
index 8123eaaabc..3e552082ee 100644
--- a/routers/admin/auths.go
+++ b/routers/admin/auths.go
@@ -63,27 +63,28 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
case models.LDAP:
u = &models.LDAPConfig{
Ldapsource: ldap.Ldapsource{
- Name: form.Name,
- Host: form.Host,
- Port: form.Port,
- UseSSL: form.UseSSL,
- BindDN: form.BindDN,
- BindPassword: form.BindPassword,
- UserBase: form.UserBase,
- Filter: form.Filter,
- AdminFilter: form.AdminFilter,
- AttributeName: form.AttributeName,
- AttributeSurname: form.AttributeSurname,
- AttributeMail: form.AttributeMail,
- Enabled: true,
+ Name: form.Name,
+ Host: form.Host,
+ Port: form.Port,
+ UseSSL: form.UseSSL,
+ BindDN: form.BindDN,
+ BindPassword: form.BindPassword,
+ UserBase: form.UserBase,
+ Filter: form.Filter,
+ AdminFilter: form.AdminFilter,
+ AttributeName: form.AttributeName,
+ AttributeSurname: form.AttributeSurname,
+ AttributeMail: form.AttributeMail,
+ Enabled: true,
},
}
case models.SMTP:
u = &models.SMTPConfig{
- Auth: form.SMTPAuth,
- Host: form.SMTPHost,
- Port: form.SMTPPort,
- TLS: form.TLS,
+ Auth: form.SMTPAuth,
+ Host: form.SMTPHost,
+ Port: form.SMTPPort,
+ TLS: form.TLS,
+ SkipVerify: form.SkipVerify,
}
case models.PAM:
u = &models.PAMConfig{
@@ -123,7 +124,7 @@ func EditAuthSource(ctx *middleware.Context) {
ctx.Handle(404, "EditAuthSource", nil)
return
}
- u, err := models.GetLoginSourceById(id)
+ u, err := models.GetLoginSourceByID(id)
if err != nil {
ctx.Handle(500, "GetLoginSourceById", err)
return
@@ -150,27 +151,28 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
case models.LDAP:
config = &models.LDAPConfig{
Ldapsource: ldap.Ldapsource{
- Name: form.Name,
- Host: form.Host,
- Port: form.Port,
- UseSSL: form.UseSSL,
- BindDN: form.BindDN,
- BindPassword: form.BindPassword,
- UserBase: form.UserBase,
- AttributeName: form.AttributeName,
- AttributeSurname: form.AttributeSurname,
- AttributeMail: form.AttributeMail,
- Filter: form.Filter,
- AdminFilter: form.AdminFilter,
- Enabled: true,
+ Name: form.Name,
+ Host: form.Host,
+ Port: form.Port,
+ UseSSL: form.UseSSL,
+ BindDN: form.BindDN,
+ BindPassword: form.BindPassword,
+ UserBase: form.UserBase,
+ AttributeName: form.AttributeName,
+ AttributeSurname: form.AttributeSurname,
+ AttributeMail: form.AttributeMail,
+ Filter: form.Filter,
+ AdminFilter: form.AdminFilter,
+ Enabled: true,
},
}
case models.SMTP:
config = &models.SMTPConfig{
- Auth: form.SMTPAuth,
- Host: form.SMTPHost,
- Port: form.SMTPPort,
- TLS: form.TLS,
+ Auth: form.SMTPAuth,
+ Host: form.SMTPHost,
+ Port: form.SMTPPort,
+ TLS: form.TLS,
+ SkipVerify: form.SkipVerify,
}
case models.PAM:
config = &models.PAMConfig{
@@ -182,7 +184,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
}
u := models.LoginSource{
- Id: form.ID,
+ ID: form.ID,
Name: form.Name,
IsActived: form.IsActived,
Type: models.LoginType(form.Type),
@@ -207,7 +209,7 @@ func DeleteAuthSource(ctx *middleware.Context) {
return
}
- a, err := models.GetLoginSourceById(id)
+ a, err := models.GetLoginSourceByID(id)
if err != nil {
ctx.Handle(500, "GetLoginSourceById", err)
return