Browse Source

more minor fix on 1581

pull/1629/head
Unknwon 9 years ago
parent
commit
fa728d8dff
  1. 5
      conf/locale/locale_en-US.ini
  2. 6
      models/login.go
  3. 2
      models/models.go
  4. 4
      modules/bindata/bindata.go
  5. 2
      public/css/gogs.min.css
  6. 4
      public/less/_admin.less
  7. 2
      routers/admin/auths.go
  8. 10
      templates/admin/auth/edit.tmpl
  9. 51
      templates/admin/auth/list.tmpl

5
conf/locale/locale_en-US.ini

@ -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

6
models/login.go

@ -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

2
models/models.go

@ -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))

4
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

2
public/css/gogs.min.css vendored

File diff suppressed because one or more lines are too long

4
public/less/_admin.less

@ -15,4 +15,8 @@
}
}
}
.ui.header,
.ui.segment {
box-shadow: 0 1px 2px 0 rgba(34,36,38,.15);
}
}

2
routers/admin/auths.go

@ -34,6 +34,8 @@ func Authentications(ctx *middleware.Context) {
ctx.Handle(500, "GetAuths", err)
return
}
ctx.Data["Total"] = models.CountLoginSources()
ctx.HTML(200, AUTHS)
}

10
templates/admin/auth/edit.tmpl

@ -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>

51
templates/admin/auth/list.tmpl

@ -1,24 +1,21 @@
{{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">
{{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>ID</th>
<th>{{.i18n.Tr "admin.auths.name"}}</th>
<th>{{.i18n.Tr "admin.auths.type"}}</th>
<th>{{.i18n.Tr "admin.auths.enabled"}}</th>
@ -34,26 +31,16 @@
<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><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>
{{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}}">&laquo; Prev.</a></li>{{end}}
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/auths?p={{.NextPageNum}}">&raquo; Next</a></li>{{end}}
</ul>
{{end}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{{template "ng/base/footer" .}}
{{template "base/footer" .}}
Loading…
Cancel
Save