more minor fix on 1581
This commit is contained in:
parent
26ac016b9f
commit
fa728d8dff
9 changed files with 70 additions and 70 deletions
|
@ -14,7 +14,7 @@ version = Version
|
|||
page = Page
|
||||
template = Template
|
||||
language = Language
|
||||
create_new = Create new...
|
||||
create_new = Create...
|
||||
user_profile_and_more = User profile and more
|
||||
signed_in_as = Signed in as
|
||||
|
||||
|
@ -718,6 +718,7 @@ notices = System Notices
|
|||
monitor = Monitoring
|
||||
prev = Prev.
|
||||
next = Next
|
||||
total = Total: %d
|
||||
|
||||
dashboard.statistic = Statistic
|
||||
dashboard.operations = Operations
|
||||
|
@ -804,7 +805,7 @@ repos.stars = Stars
|
|||
repos.issues = Issues
|
||||
|
||||
auths.auth_manage_panel = Authentication Manage Panel
|
||||
auths.new = Add New Authentication Source
|
||||
auths.new = Add New Source
|
||||
auths.name = Name
|
||||
auths.type = Type
|
||||
auths.enabled = Enabled
|
||||
|
|
|
@ -134,6 +134,12 @@ func (source *LoginSource) PAM() *PAMConfig {
|
|||
return source.Cfg.(*PAMConfig)
|
||||
}
|
||||
|
||||
// CountLoginSources returns number of login sources.
|
||||
func CountLoginSources() int64 {
|
||||
count, _ := x.Count(new(LoginSource))
|
||||
return count
|
||||
}
|
||||
|
||||
func CreateSource(source *LoginSource) error {
|
||||
_, err := x.Insert(source)
|
||||
return err
|
||||
|
|
|
@ -237,7 +237,7 @@ func GetStatistic() (stats Statistic) {
|
|||
stats.Counter.Follow, _ = x.Count(new(Follow))
|
||||
stats.Counter.Mirror, _ = x.Count(new(Mirror))
|
||||
stats.Counter.Release, _ = x.Count(new(Release))
|
||||
stats.Counter.LoginSource, _ = x.Count(new(LoginSource))
|
||||
stats.Counter.LoginSource = CountLoginSources()
|
||||
stats.Counter.Webhook, _ = x.Count(new(Webhook))
|
||||
stats.Counter.Milestone, _ = x.Count(new(Milestone))
|
||||
stats.Counter.Label, _ = x.Count(new(Label))
|
||||
|
|
File diff suppressed because one or more lines are too long
2
public/css/gogs.min.css
vendored
2
public/css/gogs.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -15,4 +15,8 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
.ui.header,
|
||||
.ui.segment {
|
||||
box-shadow: 0 1px 2px 0 rgba(34,36,38,.15);
|
||||
}
|
||||
}
|
|
@ -34,6 +34,8 @@ func Authentications(ctx *middleware.Context) {
|
|||
ctx.Handle(500, "GetAuths", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["Total"] = models.CountLoginSources()
|
||||
ctx.HTML(200, AUTHS)
|
||||
}
|
||||
|
||||
|
@ -61,7 +63,7 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
|||
var u core.Conversion
|
||||
switch models.LoginType(form.Type) {
|
||||
case models.LDAP:
|
||||
fallthrough
|
||||
fallthrough
|
||||
case models.DLDAP:
|
||||
u = &models.LDAPConfig{
|
||||
Ldapsource: ldap.Ldapsource{
|
||||
|
@ -152,7 +154,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
|||
var config core.Conversion
|
||||
switch models.LoginType(form.Type) {
|
||||
case models.LDAP:
|
||||
fallthrough
|
||||
fallthrough
|
||||
case models.DLDAP:
|
||||
config = &models.LDAPConfig{
|
||||
Ldapsource: ldap.Ldapsource{
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<input class="ipt ipt-large ipt-radius {{if .Err_AuthName}}ipt-error{{end}}" id="name" name="name" value="{{.Source.Name}}" required />
|
||||
</div>
|
||||
|
||||
{{if eq $type 2 3}}
|
||||
{{if eq $type 2 5}}
|
||||
<div class="field">
|
||||
<label class="req" for="host">{{.i18n.Tr "admin.auths.host"}}</label>
|
||||
<input class="ipt ipt-large ipt-radius {{if .Err_Host}}ipt-error{{end}}" id="host" name="host" value="{{.Source.LDAP.Host}}" required />
|
||||
|
@ -57,7 +57,7 @@
|
|||
<input class="ipt ipt-large ipt-radius {{if .Err_UserBase}}ipt-error{{end}}" id="user_base" name="user_base" value="{{.Source.LDAP.UserBase}}" />
|
||||
</div>
|
||||
{{end}}
|
||||
{{if eq $type 3}}
|
||||
{{if eq $type 5}}
|
||||
<div class="field">
|
||||
<label class="req" for="user_dn">{{.i18n.Tr "admin.auths.user_dn"}}</label>
|
||||
<input class="ipt ipt-large ipt-radius {{if .Err_UserDN}}ipt-error{{end}}" id="user_dn" name="user_dn" value="{{.Source.LDAP.UserDN}}" />
|
||||
|
@ -85,7 +85,7 @@
|
|||
</div>
|
||||
|
||||
|
||||
{{else if eq $type 4}}
|
||||
{{else if eq $type 3}}
|
||||
<div class="field">
|
||||
<label class="req">{{.i18n.Tr "admin.auths.smtp_auth"}}</label>
|
||||
<select name="smtp_auth">
|
||||
|
@ -105,7 +105,7 @@
|
|||
<input class="ipt ipt-large ipt-radius {{if .Err_SmtpPort}}ipt-error{{end}}" id="smtp_port" name="smtp_port" value="{{.Source.SMTP.Port}}" />
|
||||
</div>
|
||||
|
||||
{{else if eq $type 5}}
|
||||
{{else if eq $type 4}}
|
||||
<div class="field">
|
||||
<label class="req" for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label>
|
||||
<input class="ipt ipt-large ipt-radius {{if .Err_PAMServiceName}}ipt-error{{end}}" id="pam_service_name" name="pam_service_name" value="{{.Source.PAM.ServiceName}}" />
|
||||
|
@ -113,7 +113,7 @@
|
|||
{{end}}
|
||||
|
||||
<div class="field">
|
||||
{{if eq $type 4}}
|
||||
{{if eq $type 3}}
|
||||
<label></label>
|
||||
<input name="tls" type="checkbox" {{if .Source.SMTP.TLS}}checked{{end}}>
|
||||
<strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong>
|
||||
|
|
|
@ -1,59 +1,46 @@
|
|||
{{template "ng/base/head" .}}
|
||||
{{template "ng/base/header" .}}
|
||||
<div id="admin-wrapper">
|
||||
<div id="setting-wrapper" class="main-wrapper">
|
||||
<div id="admin-setting" class="container clear">
|
||||
{{template "admin/nav" .}}
|
||||
<div class="grid-4-5 left">
|
||||
<div class="setting-content">
|
||||
{{template "ng/base/alert" .}}
|
||||
<div id="setting-content">
|
||||
<div class="panel panel-radius">
|
||||
<div class="panel-header">
|
||||
<strong>{{.i18n.Tr "admin.auths.auth_manage_panel"}}</strong>
|
||||
</div>
|
||||
<div class="panel-body admin-panel">
|
||||
<a class="btn-blue btn-medium btn-link btn-radius" href="{{AppSubUrl}}/admin/auths/new">{{.i18n.Tr "admin.auths.new"}}</a>
|
||||
<div class="admin-table">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>{{.i18n.Tr "admin.auths.name"}}</th>
|
||||
<th>{{.i18n.Tr "admin.auths.type"}}</th>
|
||||
<th>{{.i18n.Tr "admin.auths.enabled"}}</th>
|
||||
<th>{{.i18n.Tr "admin.auths.updated"}}</th>
|
||||
<th>{{.i18n.Tr "admin.users.created"}}</th>
|
||||
<th>{{.i18n.Tr "admin.users.edit"}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .Sources}}
|
||||
<tr>
|
||||
<td>{{.ID}}</td>
|
||||
<td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}">{{.Name}}</a></td>
|
||||
<td>{{.TypeString}}</td>
|
||||
<td><i class="fa fa{{if .IsActived}}-check{{end}}-square-o"></i></td>
|
||||
<td><span title="{{DateFmtLong .Updated}}">{{DateFmtShort .Updated}}</span></td>
|
||||
<td><span title="{{DateFmtLong .Created}}">{{DateFmtShort .Created}}</span></td>
|
||||
<td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}"><i class="fa fa-pencil-square-o"></i></a></td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{if or .LastPageNum .NextPageNum}}
|
||||
<ul class="pagination">
|
||||
{{if .LastPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/auths?p={{.LastPageNum}}">« Prev.</a></li>{{end}}
|
||||
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/auths?p={{.NextPageNum}}">» Next</a></li>{{end}}
|
||||
</ul>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "base/head" .}}
|
||||
<div class="admin authentication">
|
||||
<div class="ui container">
|
||||
<div class="ui grid">
|
||||
{{template "admin/navbar" .}}
|
||||
<div class="twelve wide column content">
|
||||
{{template "base/alert" .}}
|
||||
<h4 class="ui top attached header">
|
||||
{{.i18n.Tr "admin.auths.auth_manage_panel"}} ({{.i18n.Tr "admin.total" .Total}})
|
||||
<div class="ui right">
|
||||
<a class="ui blue tiny button" href="{{AppSubUrl}}/admin/auths/new">{{.i18n.Tr "admin.auths.new"}}</a>
|
||||
</div>
|
||||
</h4>
|
||||
<div class="ui attached table segment">
|
||||
<table class="ui very basic striped table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>{{.i18n.Tr "admin.auths.name"}}</th>
|
||||
<th>{{.i18n.Tr "admin.auths.type"}}</th>
|
||||
<th>{{.i18n.Tr "admin.auths.enabled"}}</th>
|
||||
<th>{{.i18n.Tr "admin.auths.updated"}}</th>
|
||||
<th>{{.i18n.Tr "admin.users.created"}}</th>
|
||||
<th>{{.i18n.Tr "admin.users.edit"}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .Sources}}
|
||||
<tr>
|
||||
<td>{{.ID}}</td>
|
||||
<td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}">{{.Name}}</a></td>
|
||||
<td>{{.TypeString}}</td>
|
||||
<td><i class="fa fa{{if .IsActived}}-check{{end}}-square-o"></i></td>
|
||||
<td><span class="poping up" data-content="{{DateFmtLong .Updated}}" data-variation="tiny">{{DateFmtShort .Updated}}</span></td>
|
||||
<td><span class="poping up" data-content="{{DateFmtLong .Created}}" data-variation="tiny">{{DateFmtShort .Created}}</span></td>
|
||||
<td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}"><i class="fa fa-pencil-square-o"></i></a></td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "ng/base/footer" .}}
|
||||
{{template "base/footer" .}}
|
Loading…
Reference in a new issue