mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-24 03:21:49 +01:00
Fix #173
This commit is contained in:
parent
f68e279150
commit
2c73ced0db
3 changed files with 44 additions and 42 deletions
|
@ -650,3 +650,7 @@ function initRepoSetting() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
String.prototype.endsWith = function(suffix) {
|
||||||
|
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
||||||
|
};
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/go-martini/martini"
|
"github.com/go-martini/martini"
|
||||||
"github.com/go-xorm/core"
|
"github.com/go-xorm/core"
|
||||||
|
|
||||||
"github.com/gogits/gogs/models"
|
"github.com/gogits/gogs/models"
|
||||||
"github.com/gogits/gogs/modules/auth"
|
"github.com/gogits/gogs/modules/auth"
|
||||||
"github.com/gogits/gogs/modules/auth/ldap"
|
"github.com/gogits/gogs/modules/auth/ldap"
|
||||||
|
@ -114,7 +115,8 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var config core.Conversion
|
var config core.Conversion
|
||||||
if form.Type == models.LT_LDAP {
|
switch form.Type {
|
||||||
|
case models.LT_LDAP:
|
||||||
config = &models.LDAPConfig{
|
config = &models.LDAPConfig{
|
||||||
Ldapsource: ldap.Ldapsource{
|
Ldapsource: ldap.Ldapsource{
|
||||||
Host: form.Host,
|
Host: form.Host,
|
||||||
|
@ -127,13 +129,16 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||||
Name: form.AuthName,
|
Name: form.AuthName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else if form.Type == models.LT_SMTP {
|
case models.LT_SMTP:
|
||||||
config = &models.SMTPConfig{
|
config = &models.SMTPConfig{
|
||||||
Auth: form.SmtpAuth,
|
Auth: form.SmtpAuth,
|
||||||
Host: form.Host,
|
Host: form.Host,
|
||||||
Port: form.Port,
|
Port: form.Port,
|
||||||
TLS: form.Tls,
|
TLS: form.Tls,
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
ctx.Error(400)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
u := models.LoginSource{
|
u := models.LoginSource{
|
||||||
|
@ -145,10 +150,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := models.UpdateSource(&u); err != nil {
|
if err := models.UpdateSource(&u); err != nil {
|
||||||
switch err {
|
ctx.Handle(500, "admin.auths.EditAuth", err)
|
||||||
default:
|
|
||||||
ctx.Handle(500, "admin.auths.EditAuth", err)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if eq $type 2}}
|
{{if eq $type 2}}
|
||||||
|
|
||||||
<div class="form-group {{if .Err_Domain}}has-error has-feedback{{end}}">
|
<div class="form-group {{if .Err_Domain}}has-error has-feedback{{end}}">
|
||||||
<label class="col-md-3 control-label">Domain: </label>
|
<label class="col-md-3 control-label">Domain: </label>
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
|
@ -81,44 +80,41 @@
|
||||||
<input name="ms_ad_sa" class="form-control" placeholder="Type Ms Ad SA" value="{{.Source.LDAP.MsAdSAFormat}}" required="required">
|
<input name="ms_ad_sa" class="form-control" placeholder="Type Ms Ad SA" value="{{.Source.LDAP.MsAdSAFormat}}" required="required">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else if eq $type 3}}
|
||||||
{{if eq $type 3}}
|
<div class="form-group {{if .Err_TLS}}has-error has-feedback{{end}}">
|
||||||
|
<label class="col-md-3 control-label">SMTP Auth: </label>
|
||||||
|
<div class="col-md-7">
|
||||||
|
<select name="smtpauth" class="form-control">
|
||||||
|
{{$auth := .Source.SMTP.Auth}}
|
||||||
|
{{range .SMTPAuths}}
|
||||||
|
<option value="{{.}}"
|
||||||
|
{{if eq . $auth}} selected{{end}}>{{.}}</option>
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group {{if .Err_Host}}has-error has-feedback{{end}}">
|
||||||
|
<label class="col-md-3 control-label">Host: </label>
|
||||||
|
<div class="col-md-7">
|
||||||
|
<input name="smtphost" class="form-control" placeholder="Type host address" value="{{.Source.SMTP.Host}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group {{if .Err_Port}}has-error has-feedback{{end}}">
|
||||||
|
<label class="col-md-3 control-label">Port: </label>
|
||||||
|
<div class="col-md-7">
|
||||||
|
<input name="smtpport" class="form-control" placeholder="Type port number" value="{{.Source.SMTP.Port}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group {{if .Err_TLS}}has-error has-feedback{{end}}">
|
<div class="form-group {{if .Err_TLS}}has-error has-feedback{{end}}">
|
||||||
<label class="col-md-3 control-label">SMTP Auth: </label>
|
<label class="col-md-3 control-label">TLS: </label>
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<select name="smtpauth" class="form-control">
|
<input name="smtptls" type="checkbox" class="form-control" {{if .Source.SMTP.TLS}}checked{{end}}>
|
||||||
{{$auth := .Source.SMTP.Auth}}
|
|
||||||
{{range .SMTPAuths}}
|
|
||||||
<option value="{{.}}"
|
|
||||||
{{if eq . $auth}} selected{{end}}>{{.}}</option>
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group {{if .Err_Host}}has-error has-feedback{{end}}">
|
|
||||||
<label class="col-md-3 control-label">Host: </label>
|
|
||||||
<div class="col-md-7">
|
|
||||||
<input name="smtphost" class="form-control" placeholder="Type host address" value="{{.Source.SMTP.Host}}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group {{if .Err_Port}}has-error has-feedback{{end}}">
|
|
||||||
<label class="col-md-3 control-label">Port: </label>
|
|
||||||
<div class="col-md-7">
|
|
||||||
<input name="smtpport" class="form-control" placeholder="Type port number" value="{{.Source.SMTP.Port}}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group {{if .Err_TLS}}has-error has-feedback{{end}}">
|
|
||||||
<label class="col-md-3 control-label">TLS: </label>
|
|
||||||
<div class="col-md-7">
|
|
||||||
<input name="smtptls" type="checkbox" class="form-control" {{if .Source.SMTP.TLS}}checked{{end}}>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<div class="form-group {{if .Err_TLS}}has-error has-feedback{{end}}">
|
<div class="form-group {{if .Err_TLS}}has-error has-feedback{{end}}">
|
||||||
|
|
Loading…
Reference in a new issue