mirror of
https://github.com/go-gitea/gitea
synced 2024-11-15 14:31:41 +01:00
Fix edit auth page bug
This commit is contained in:
parent
1769bb2f26
commit
f1130ce5e9
7 changed files with 41 additions and 31 deletions
|
@ -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.
|
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 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 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)
|
- [Ship with Docker](https://github.com/gogits/gogs/tree/master/dockerfiles)
|
||||||
- [Install with Vagrant](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs)
|
- [Install with Vagrant](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs)
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,11 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依
|
||||||
|
|
||||||
在安装 Gogs 之前,您需要先安装 [基本环境](http://gogs.io/docs/installation/)。
|
在安装 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_binary.md): **强烈推荐**
|
||||||
- [源码安装](http://gogs.io/docs/installation/install_from_source.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)
|
- [采用 Docker 部署](https://github.com/gogits/gogs/tree/master/dockerfiles)
|
||||||
- [通过 Vagrant 安装](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs)
|
- [通过 Vagrant 安装](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs)
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,11 @@ var LoginTypes = map[int]string{
|
||||||
LT_SMTP: "SMTP",
|
LT_SMTP: "SMTP",
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ core.Conversion = &LDAPConfig{}
|
// Ensure structs implmented interface.
|
||||||
var _ core.Conversion = &SMTPConfig{}
|
var (
|
||||||
|
_ core.Conversion = &LDAPConfig{}
|
||||||
|
_ core.Conversion = &SMTPConfig{}
|
||||||
|
)
|
||||||
|
|
||||||
type LDAPConfig struct {
|
type LDAPConfig struct {
|
||||||
ldap.Ldapsource
|
ldap.Ldapsource
|
||||||
|
|
|
@ -27,6 +27,8 @@ type AuthenticationForm struct {
|
||||||
MsAdSA string `form:"ms_ad_sa"`
|
MsAdSA string `form:"ms_ad_sa"`
|
||||||
IsActived bool `form:"is_actived"`
|
IsActived bool `form:"is_actived"`
|
||||||
SmtpAuth string `form:"smtpauth"`
|
SmtpAuth string `form:"smtpauth"`
|
||||||
|
SmtpHost string `form:"smtphost"`
|
||||||
|
SmtpPort int `form:"smtpport"`
|
||||||
Tls bool `form:"tls"`
|
Tls bool `form:"tls"`
|
||||||
AllowAutoRegister bool `form:"allowautoregister"`
|
AllowAutoRegister bool `form:"allowautoregister"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,8 +55,8 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||||
case models.LT_SMTP:
|
case models.LT_SMTP:
|
||||||
u = &models.SMTPConfig{
|
u = &models.SMTPConfig{
|
||||||
Auth: form.SmtpAuth,
|
Auth: form.SmtpAuth,
|
||||||
Host: form.Host,
|
Host: form.SmtpHost,
|
||||||
Port: form.Port,
|
Port: form.SmtpPort,
|
||||||
TLS: form.Tls,
|
TLS: form.Tls,
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -132,8 +132,8 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||||
case models.LT_SMTP:
|
case models.LT_SMTP:
|
||||||
config = &models.SMTPConfig{
|
config = &models.SMTPConfig{
|
||||||
Auth: form.SmtpAuth,
|
Auth: form.SmtpAuth,
|
||||||
Host: form.Host,
|
Host: form.SmtpHost,
|
||||||
Port: form.Port,
|
Port: form.SmtpPort,
|
||||||
TLS: form.Tls,
|
TLS: form.Tls,
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 control-label">Auth Type: </label>
|
<label class="col-md-3 control-label">Auth Type: </label>
|
||||||
<input type="hidden" name="type" value="{{.Source.Type}}"/>
|
<input type="hidden" name="type" value="{{.Source.Type}}"/>
|
||||||
<div class="col-md-7">
|
<label class="control-label">
|
||||||
{{range $key, $val := .LoginTypes}}
|
{{range $key, $val := .LoginTypes}}
|
||||||
{{if eq $key $type}}{{$val}}{{end}}
|
{{if eq $key $type}}{{$val}}{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group {{if .Err_AuthName}}has-error has-feedback{{end}}">
|
<div class="form-group {{if .Err_AuthName}}has-error has-feedback{{end}}">
|
||||||
<label class="col-md-3 control-label">Name: </label>
|
<label class="col-md-3 control-label">Name: </label>
|
||||||
|
@ -85,46 +85,47 @@
|
||||||
<label class="col-md-3 control-label">SMTP Auth: </label>
|
<label class="col-md-3 control-label">SMTP Auth: </label>
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<select name="smtpauth" class="form-control">
|
<select name="smtpauth" class="form-control">
|
||||||
{{$auth := .Source.SMTP.Auth}}
|
{{$auth := .Source.SMTP.Auth}}
|
||||||
{{range .SMTPAuths}}
|
{{range .SMTPAuths}}
|
||||||
<option value="{{.}}"
|
<option value="{{.}}"
|
||||||
{{if eq . $auth}} selected{{end}}>{{.}}</option>
|
{{if eq . $auth}} selected{{end}}>{{.}}</option>
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group {{if .Err_Host}}has-error has-feedback{{end}}">
|
<div class="form-group {{if .Err_SmtpHost}}has-error has-feedback{{end}}">
|
||||||
<label class="col-md-3 control-label">Host: </label>
|
<label class="col-md-3 control-label">Host: </label>
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<input name="smtphost" class="form-control" placeholder="Type host address" value="{{.Source.SMTP.Host}}">
|
<input name="smtphost" class="form-control" placeholder="Type host address" value="{{.Source.SMTP.Host}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group {{if .Err_Port}}has-error has-feedback{{end}}">
|
<div class="form-group {{if .Err_SmtpPort}}has-error has-feedback{{end}}">
|
||||||
<label class="col-md-3 control-label">Port: </label>
|
<label class="col-md-3 control-label">Port: </label>
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<input name="smtpport" class="form-control" placeholder="Type port number" value="{{.Source.SMTP.Port}}">
|
<input name="smtpport" class="form-control" placeholder="Type port number" value="{{.Source.SMTP.Port}}">
|
||||||
</div>
|
</div>
|
||||||
</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">TLS: </label>
|
<label class="col-md-3 control-label">TLS: </label>
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<input name="smtptls" type="checkbox" class="form-control" {{if .Source.SMTP.TLS}}checked{{end}}>
|
<input name="tls" type="checkbox" class="form-control" {{if .Source.SMTP.TLS}}checked{{end}}>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<div class="form-group {{if .Err_TLS}}has-error has-feedback{{end}}">
|
|
||||||
<label class="col-md-3 control-label">Auto Register: </label>
|
|
||||||
<div class="col-md-7">
|
|
||||||
<input name="allowautoregister" type="checkbox" class="form-control" {{if .Source.AllowAutoRegister}}checked{{end}}>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
<div class="col-md-offset-3 col-md-7">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input name="allowautoregister" type="checkbox" {{if .Source.AllowAutoRegister}}checked{{end}}>
|
||||||
|
<strong>Enable Auto Registeration</strong>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-7 col-md-offset-3">
|
<div class="col-md-7 col-md-offset-3">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
|
@ -134,7 +135,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-offset-3 col-md-6">
|
<div class="col-md-offset-3 col-md-6">
|
||||||
<button type="submit" class="btn btn-lg btn-primary btn-block">Update authentication config</button>
|
<button type="submit" class="btn btn-lg btn-primary btn-block">Update authentication config</button>
|
||||||
|
|
|
@ -93,17 +93,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group {{if .Err_Host}}has-error has-feedback{{end}}">
|
<div class="form-group {{if .Err_SmtpHost}}has-error has-feedback{{end}}">
|
||||||
<label class="col-md-3 control-label">Host: </label>
|
<label class="col-md-3 control-label">Host: </label>
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<input name="host" class="form-control" placeholder="Type host address" value="{{.host}}">
|
<input name="smtphost" class="form-control" placeholder="Type host address" value="{{.smtphost}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group {{if .Err_Port}}has-error has-feedback{{end}}">
|
<div class="form-group {{if .Err_SmtpPort}}has-error has-feedback{{end}}">
|
||||||
<label class="col-md-3 control-label">Port: </label>
|
<label class="col-md-3 control-label">Port: </label>
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<input name="port" class="form-control" placeholder="Type port number" value="{{.port}}">
|
<input name="smtpport" class="form-control" placeholder="Type port number" value="{{.smtpport}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue