diff options
author | Patrick G <geek1011@users.noreply.github.com> | 2017-03-15 22:39:38 +0000 |
---|---|---|
committer | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2017-03-15 23:39:38 +0100 |
commit | efbb895ebe33327630195ac52f10bd3d85bbae00 (patch) | |
tree | 988e09097921de93e11149fcdff7b3951ae39e90 /templates/admin/auth | |
parent | 03d79983ee40a22039b5fd1a204499977ab87254 (diff) | |
download | gitea-efbb895ebe33327630195ac52f10bd3d85bbae00.tar.gz gitea-efbb895ebe33327630195ac52f10bd3d85bbae00.zip |
Cleaner ui for admin, repo settings, and user settings page (#1269) (#1270)
Diffstat (limited to 'templates/admin/auth')
-rw-r--r-- | templates/admin/auth/edit.tmpl | 360 | ||||
-rw-r--r-- | templates/admin/auth/list.tmpl | 72 | ||||
-rw-r--r-- | templates/admin/auth/new.tmpl | 362 |
3 files changed, 391 insertions, 403 deletions
diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl index 84b62f6e87..ea5104b79f 100644 --- a/templates/admin/auth/edit.tmpl +++ b/templates/admin/auth/edit.tmpl @@ -1,199 +1,195 @@ {{template "base/head" .}} <div class="admin edit authentication"> + {{template "admin/navbar" .}} <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.edit"}} - </h4> - <div class="ui attached segment"> - <form class="ui form" action="{{.Link}}" method="post"> - {{.CsrfTokenHtml}} - <input type="hidden" name="id" value="{{.Source.ID}}"> - <div class="inline field"> - <label>{{$.i18n.Tr "admin.auths.auth_type"}}</label> - <input type="hidden" id="auth_type" name="type" value="{{.Source.Type}}"> - <span>{{.Source.TypeName}}</span> - </div> - <div class="required inline field {{if .Err_Name}}error{{end}}"> - <label for="name">{{.i18n.Tr "admin.auths.auth_name"}}</label> - <input id="name" name="name" value="{{.Source.Name}}" autofocus required> - </div> - - <!-- LDAP and DLDAP --> - {{if or .Source.IsLDAP .Source.IsDLDAP}} - {{ $cfg:=.Source.LDAP }} - <div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}"> - <label>{{.i18n.Tr "admin.auths.security_protocol"}}</label> - <div class="ui selection security-protocol dropdown"> - <input type="hidden" id="security_protocol" name="security_protocol" value="{{$cfg.SecurityProtocol}}"> - <div class="text">{{$cfg.SecurityProtocolName}}</div> - <i class="dropdown icon"></i> - <div class="menu"> - {{range .SecurityProtocols}} - <div class="item" data-value="{{.Type}}">{{.Name}}</div> - {{end}} - </div> - </div> - </div> - <div class="required field"> - <label for="host">{{.i18n.Tr "admin.auths.host"}}</label> - <input id="host" name="host" value="{{$cfg.Host}}" placeholder="e.g. mydomain.com" required> - </div> - <div class="required field"> - <label for="port">{{.i18n.Tr "admin.auths.port"}}</label> - <input id="port" name="port" value="{{$cfg.Port}}" placeholder="e.g. 636" required> - </div> - {{if .Source.IsLDAP}} - <div class="field"> - <label for="bind_dn">{{.i18n.Tr "admin.auths.bind_dn"}}</label> - <input id="bind_dn" name="bind_dn" value="{{$cfg.BindDN}}" placeholder="e.g. cn=Search,dc=mydomain,dc=com"> - </div> - <input class="fake" type="password"> - <div class="field"> - <label for="bind_password">{{.i18n.Tr "admin.auths.bind_password"}}</label> - <input id="bind_password" name="bind_password" type="password" value="{{$cfg.BindPassword}}"> - <p class="help text red">{{.i18n.Tr "admin.auths.bind_password_helper"}}</p> - </div> - <div class="required field"> - <label for="user_base">{{.i18n.Tr "admin.auths.user_base"}}</label> - <input id="user_base" name="user_base" value="{{$cfg.UserBase}}" placeholder="e.g. ou=Users,dc=mydomain,dc=com" required> - </div> - {{end}} - {{if .Source.IsDLDAP}} - <div class="required field"> - <label for="user_dn">{{.i18n.Tr "admin.auths.user_dn"}}</label> - <input id="user_dn" name="user_dn" value="{{$cfg.UserDN}}" placeholder="e.g. uid=%s,ou=Users,dc=mydomain,dc=com" required> - </div> - {{end}} - <div class="required field"> - <label for="filter">{{.i18n.Tr "admin.auths.filter"}}</label> - <input id="filter" name="filter" value="{{$cfg.Filter}}" placeholder="e.g. (&(objectClass=posixAccount)(uid=%s))" required> - </div> - <div class="field"> - <label for="admin_filter">{{.i18n.Tr "admin.auths.admin_filter"}}</label> - <input id="admin_filter" name="admin_filter" value="{{$cfg.AdminFilter}}"> - </div> - <div class="field"> - <label for="attribute_username">{{.i18n.Tr "admin.auths.attribute_username"}}</label> - <input id="attribute_username" name="attribute_username" value="{{$cfg.AttributeUsername}}" placeholder="{{.i18n.Tr "admin.auths.attribute_username_placeholder"}}"> - </div> - <div class="field"> - <label for="attribute_name">{{.i18n.Tr "admin.auths.attribute_name"}}</label> - <input id="attribute_name" name="attribute_name" value="{{$cfg.AttributeName}}"> - </div> - <div class="field"> - <label for="attribute_surname">{{.i18n.Tr "admin.auths.attribute_surname"}}</label> - <input id="attribute_surname" name="attribute_surname" value="{{$cfg.AttributeSurname}}"> - </div> - <div class="required field"> - <label for="attribute_mail">{{.i18n.Tr "admin.auths.attribute_mail"}}</label> - <input id="attribute_mail" name="attribute_mail" value="{{$cfg.AttributeMail}}" placeholder="e.g. mail" required> - </div> - {{if .Source.IsLDAP}} - <div class="inline field"> - <div class="ui checkbox"> - <label><strong>{{.i18n.Tr "admin.auths.attributes_in_bind"}}</strong></label> - <input name="attributes_in_bind" type="checkbox" {{if $cfg.AttributesInBind}}checked{{end}}> - </div> - </div> - {{end}} - {{end}} - - <!-- SMTP --> - {{if .Source.IsSMTP}} - {{ $cfg:=.Source.SMTP }} - <div class="inline required field"> - <label>{{.i18n.Tr "admin.auths.smtp_auth"}}</label> - <div class="ui selection type dropdown"> - <input type="hidden" id="smtp_auth" name="smtp_auth" value="{{$cfg.Auth}}" required> - <div class="text">{{$cfg.Auth}}</div> - <i class="dropdown icon"></i> - <div class="menu"> - {{range .SMTPAuths}} - <div class="item" data-value="{{.}}">{{.}}</div> - {{end}} - </div> - </div> - </div> - <div class="required field"> - <label for="smtp_host">{{.i18n.Tr "admin.auths.smtphost"}}</label> - <input id="smtp_host" name="smtp_host" value="{{$cfg.Host}}" required> - </div> - <div class="required field"> - <label for="smtp_port">{{.i18n.Tr "admin.auths.smtpport"}}</label> - <input id="smtp_port" name="smtp_port" value="{{$cfg.Port}}" required> - </div> - <div class="field"> - <label for="allowed_domains">{{.i18n.Tr "admin.auths.allowed_domains"}}</label> - <input id="allowed_domains" name="allowed_domains" value="{{$cfg.AllowedDomains}}"> - <p class="help">{{.i18n.Tr "admin.auths.allowed_domains_helper"}}</p> - </div> - {{end}} - - <!-- PAM --> - {{if .Source.IsPAM}} - {{ $cfg:=.Source.PAM }} - <div class="required field"> - <label for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label> - <input id="pam_service_name" name="pam_service_name" value="{{$cfg.ServiceName}}" required> - </div> - {{end}} - - <!-- OAuth2 --> - {{if .Source.IsOAuth2}} - {{ $cfg:=.Source.OAuth2 }} - <div class="inline required field"> - <label>{{.i18n.Tr "admin.auths.oauth2_provider"}}</label> - <div class="ui selection type dropdown"> - <input type="hidden" id="oauth2_provider" name="oauth2_provider" value="{{$cfg.Provider}}" required> - <div class="text">{{.CurrentOAuth2Provider.DisplayName}}</div> - <i class="dropdown icon"></i> - <div class="menu"> - {{range $key, $value := .OAuth2Providers}} - <div class="item" data-value="{{$key}}">{{$value.DisplayName}}</div> - {{end}} - </div> - </div> - </div> - <div class="required field"> - <label for="oauth2_key">{{.i18n.Tr "admin.auths.oauth2_clientID"}}</label> - <input id="oauth2_key" name="oauth2_key" value="{{$cfg.ClientID}}" required> - </div> - <div class="required field"> - <label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label> - <input id="oauth2_secret" name="oauth2_secret" value="{{$cfg.ClientSecret}}" required> - </div> - {{end}} + {{template "base/alert" .}} + <h4 class="ui top attached header"> + {{.i18n.Tr "admin.auths.edit"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="id" value="{{.Source.ID}}"> + <div class="inline field"> + <label>{{$.i18n.Tr "admin.auths.auth_type"}}</label> + <input type="hidden" id="auth_type" name="type" value="{{.Source.Type}}"> + <span>{{.Source.TypeName}}</span> + </div> + <div class="required inline field {{if .Err_Name}}error{{end}}"> + <label for="name">{{.i18n.Tr "admin.auths.auth_name"}}</label> + <input id="name" name="name" value="{{.Source.Name}}" autofocus required> + </div> - <div class="inline field {{if not .Source.IsSMTP}}hide{{end}}"> - <div class="ui checkbox"> - <label><strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong></label> - <input name="tls" type="checkbox" {{if .Source.UseTLS}}checked{{end}}> + <!-- LDAP and DLDAP --> + {{if or .Source.IsLDAP .Source.IsDLDAP}} + {{ $cfg:=.Source.LDAP }} + <div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}"> + <label>{{.i18n.Tr "admin.auths.security_protocol"}}</label> + <div class="ui selection security-protocol dropdown"> + <input type="hidden" id="security_protocol" name="security_protocol" value="{{$cfg.SecurityProtocol}}"> + <div class="text">{{$cfg.SecurityProtocolName}}</div> + <i class="dropdown icon"></i> + <div class="menu"> + {{range .SecurityProtocols}} + <div class="item" data-value="{{.Type}}">{{.Name}}</div> + {{end}} </div> </div> - <div class="has-tls inline field {{if not .HasTLS}}hide{{end}}"> - <div class="ui checkbox"> - <label><strong>{{.i18n.Tr "admin.auths.skip_tls_verify"}}</strong></label> - <input name="skip_verify" type="checkbox" {{if .Source.SkipVerify}}checked{{end}}> - </div> + </div> + <div class="required field"> + <label for="host">{{.i18n.Tr "admin.auths.host"}}</label> + <input id="host" name="host" value="{{$cfg.Host}}" placeholder="e.g. mydomain.com" required> + </div> + <div class="required field"> + <label for="port">{{.i18n.Tr "admin.auths.port"}}</label> + <input id="port" name="port" value="{{$cfg.Port}}" placeholder="e.g. 636" required> + </div> + {{if .Source.IsLDAP}} + <div class="field"> + <label for="bind_dn">{{.i18n.Tr "admin.auths.bind_dn"}}</label> + <input id="bind_dn" name="bind_dn" value="{{$cfg.BindDN}}" placeholder="e.g. cn=Search,dc=mydomain,dc=com"> + </div> + <input class="fake" type="password"> + <div class="field"> + <label for="bind_password">{{.i18n.Tr "admin.auths.bind_password"}}</label> + <input id="bind_password" name="bind_password" type="password" value="{{$cfg.BindPassword}}"> + <p class="help text red">{{.i18n.Tr "admin.auths.bind_password_helper"}}</p> + </div> + <div class="required field"> + <label for="user_base">{{.i18n.Tr "admin.auths.user_base"}}</label> + <input id="user_base" name="user_base" value="{{$cfg.UserBase}}" placeholder="e.g. ou=Users,dc=mydomain,dc=com" required> + </div> + {{end}} + {{if .Source.IsDLDAP}} + <div class="required field"> + <label for="user_dn">{{.i18n.Tr "admin.auths.user_dn"}}</label> + <input id="user_dn" name="user_dn" value="{{$cfg.UserDN}}" placeholder="e.g. uid=%s,ou=Users,dc=mydomain,dc=com" required> </div> + {{end}} + <div class="required field"> + <label for="filter">{{.i18n.Tr "admin.auths.filter"}}</label> + <input id="filter" name="filter" value="{{$cfg.Filter}}" placeholder="e.g. (&(objectClass=posixAccount)(uid=%s))" required> + </div> + <div class="field"> + <label for="admin_filter">{{.i18n.Tr "admin.auths.admin_filter"}}</label> + <input id="admin_filter" name="admin_filter" value="{{$cfg.AdminFilter}}"> + </div> + <div class="field"> + <label for="attribute_username">{{.i18n.Tr "admin.auths.attribute_username"}}</label> + <input id="attribute_username" name="attribute_username" value="{{$cfg.AttributeUsername}}" placeholder="{{.i18n.Tr "admin.auths.attribute_username_placeholder"}}"> + </div> + <div class="field"> + <label for="attribute_name">{{.i18n.Tr "admin.auths.attribute_name"}}</label> + <input id="attribute_name" name="attribute_name" value="{{$cfg.AttributeName}}"> + </div> + <div class="field"> + <label for="attribute_surname">{{.i18n.Tr "admin.auths.attribute_surname"}}</label> + <input id="attribute_surname" name="attribute_surname" value="{{$cfg.AttributeSurname}}"> + </div> + <div class="required field"> + <label for="attribute_mail">{{.i18n.Tr "admin.auths.attribute_mail"}}</label> + <input id="attribute_mail" name="attribute_mail" value="{{$cfg.AttributeMail}}" placeholder="e.g. mail" required> + </div> + {{if .Source.IsLDAP}} <div class="inline field"> <div class="ui checkbox"> - <label><strong>{{.i18n.Tr "admin.auths.activated"}}</strong></label> - <input name="is_active" type="checkbox" {{if .Source.IsActived}}checked{{end}}> + <label><strong>{{.i18n.Tr "admin.auths.attributes_in_bind"}}</strong></label> + <input name="attributes_in_bind" type="checkbox" {{if $cfg.AttributesInBind}}checked{{end}}> </div> </div> + {{end}} + {{end}} - <div class="field"> - <button class="ui green button">{{.i18n.Tr "admin.auths.update"}}</button> - <div class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.Source.ID}}">{{.i18n.Tr "admin.auths.delete"}}</div> + <!-- SMTP --> + {{if .Source.IsSMTP}} + {{ $cfg:=.Source.SMTP }} + <div class="inline required field"> + <label>{{.i18n.Tr "admin.auths.smtp_auth"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="smtp_auth" name="smtp_auth" value="{{$cfg.Auth}}" required> + <div class="text">{{$cfg.Auth}}</div> + <i class="dropdown icon"></i> + <div class="menu"> + {{range .SMTPAuths}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} + </div> + </div> + </div> + <div class="required field"> + <label for="smtp_host">{{.i18n.Tr "admin.auths.smtphost"}}</label> + <input id="smtp_host" name="smtp_host" value="{{$cfg.Host}}" required> + </div> + <div class="required field"> + <label for="smtp_port">{{.i18n.Tr "admin.auths.smtpport"}}</label> + <input id="smtp_port" name="smtp_port" value="{{$cfg.Port}}" required> + </div> + <div class="field"> + <label for="allowed_domains">{{.i18n.Tr "admin.auths.allowed_domains"}}</label> + <input id="allowed_domains" name="allowed_domains" value="{{$cfg.AllowedDomains}}"> + <p class="help">{{.i18n.Tr "admin.auths.allowed_domains_helper"}}</p> + </div> + {{end}} + + <!-- PAM --> + {{if .Source.IsPAM}} + {{ $cfg:=.Source.PAM }} + <div class="required field"> + <label for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label> + <input id="pam_service_name" name="pam_service_name" value="{{$cfg.ServiceName}}" required> + </div> + {{end}} + + <!-- OAuth2 --> + {{if .Source.IsOAuth2}} + {{ $cfg:=.Source.OAuth2 }} + <div class="inline required field"> + <label>{{.i18n.Tr "admin.auths.oauth2_provider"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="oauth2_provider" name="oauth2_provider" value="{{$cfg.Provider}}" required> + <div class="text">{{.CurrentOAuth2Provider.DisplayName}}</div> + <i class="dropdown icon"></i> + <div class="menu"> + {{range $key, $value := .OAuth2Providers}} + <div class="item" data-value="{{$key}}">{{$value.DisplayName}}</div> + {{end}} + </div> </div> - </form> + </div> + <div class="required field"> + <label for="oauth2_key">{{.i18n.Tr "admin.auths.oauth2_clientID"}}</label> + <input id="oauth2_key" name="oauth2_key" value="{{$cfg.ClientID}}" required> + </div> + <div class="required field"> + <label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label> + <input id="oauth2_secret" name="oauth2_secret" value="{{$cfg.ClientSecret}}" required> + </div> + {{end}} + + <div class="inline field {{if not .Source.IsSMTP}}hide{{end}}"> + <div class="ui checkbox"> + <label><strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong></label> + <input name="tls" type="checkbox" {{if .Source.UseTLS}}checked{{end}}> + </div> + </div> + <div class="has-tls inline field {{if not .HasTLS}}hide{{end}}"> + <div class="ui checkbox"> + <label><strong>{{.i18n.Tr "admin.auths.skip_tls_verify"}}</strong></label> + <input name="skip_verify" type="checkbox" {{if .Source.SkipVerify}}checked{{end}}> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{.i18n.Tr "admin.auths.activated"}}</strong></label> + <input name="is_active" type="checkbox" {{if .Source.IsActived}}checked{{end}}> + </div> + </div> + + <div class="field"> + <button class="ui green button">{{.i18n.Tr "admin.auths.update"}}</button> + <div class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.Source.ID}}">{{.i18n.Tr "admin.auths.delete"}}</div> </div> - </div> + </form> </div> </div> </div> diff --git a/templates/admin/auth/list.tmpl b/templates/admin/auth/list.tmpl index 58bdc66b2c..4e8fb1ea82 100644 --- a/templates/admin/auth/list.tmpl +++ b/templates/admin/auth/list.tmpl @@ -1,45 +1,41 @@ {{template "base/head" .}} <div class="admin authentication"> + {{template "admin/navbar" .}} <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>{{.TypeName}}</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> + {{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>{{.TypeName}}</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> diff --git a/templates/admin/auth/new.tmpl b/templates/admin/auth/new.tmpl index 24257a1b65..59990fc37e 100644 --- a/templates/admin/auth/new.tmpl +++ b/templates/admin/auth/new.tmpl @@ -1,204 +1,200 @@ {{template "base/head" .}} <div class="admin new authentication"> + {{template "admin/navbar" .}} <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.new"}} - </h4> - <div class="ui attached segment"> - <form class="ui form" action="{{.Link}}" method="post"> - {{.CsrfTokenHtml}} - <!-- Types and name --> - <div class="inline required field {{if .Err_Type}}error{{end}}"> - <label>{{.i18n.Tr "admin.auths.auth_type"}}</label> - <div class="ui selection type dropdown"> - <input type="hidden" id="auth_type" name="type" value="{{.type}}"> - <div class="text">{{.CurrentTypeName}}</div> - <i class="dropdown icon"></i> - <div class="menu"> - {{range .AuthSources}} - <div class="item" data-value="{{.Type}}">{{.Name}}</div> - {{end}} - </div> - </div> - </div> - <div class="required inline field {{if .Err_Name}}error{{end}}"> - <label for="name">{{.i18n.Tr "admin.auths.auth_name"}}</label> - <input id="name" name="name" value="{{.name}}" autofocus required> + {{template "base/alert" .}} + <h4 class="ui top attached header"> + {{.i18n.Tr "admin.auths.new"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <!-- Types and name --> + <div class="inline required field {{if .Err_Type}}error{{end}}"> + <label>{{.i18n.Tr "admin.auths.auth_type"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="auth_type" name="type" value="{{.type}}"> + <div class="text">{{.CurrentTypeName}}</div> + <i class="dropdown icon"></i> + <div class="menu"> + {{range .AuthSources}} + <div class="item" data-value="{{.Type}}">{{.Name}}</div> + {{end}} </div> + </div> + </div> + <div class="required inline field {{if .Err_Name}}error{{end}}"> + <label for="name">{{.i18n.Tr "admin.auths.auth_name"}}</label> + <input id="name" name="name" value="{{.name}}" autofocus required> + </div> - <!-- LDAP and DLDAP --> - <div class="ldap dldap field {{if not (or (eq .type 2) (eq .type 5))}}hide{{end}}"> - <div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}"> - <label>{{.i18n.Tr "admin.auths.security_protocol"}}</label> - <div class="ui selection security-protocol dropdown"> - <input type="hidden" id="security_protocol" name="security_protocol" value="{{.security_protocol}}"> - <div class="text">{{.CurrentSecurityProtocol}}</div> - <i class="dropdown icon"></i> - <div class="menu"> - {{range .SecurityProtocols}} - <div class="item" data-value="{{.Type}}">{{.Name}}</div> - {{end}} - </div> - </div> - </div> - <div class="required field"> - <label for="host">{{.i18n.Tr "admin.auths.host"}}</label> - <input id="host" name="host" value="{{.host}}" placeholder="e.g. mydomain.com"> - </div> - <div class="required field"> - <label for="port">{{.i18n.Tr "admin.auths.port"}}</label> - <input id="port" name="port" value="{{.port}}" placeholder="e.g. 636"> - </div> - <div class="ldap field {{if not (eq .type 2)}}hide{{end}}"> - <label for="bind_dn">{{.i18n.Tr "admin.auths.bind_dn"}}</label> - <input id="bind_dn" name="bind_dn" value="{{.bind_dn}}" placeholder="e.g. cn=Search,dc=mydomain,dc=com"> - </div> - <input class="fake" type="password"> - <div class="ldap field {{if not (eq .type 2)}}hide{{end}}"> - <label for="bind_password">{{.i18n.Tr "admin.auths.bind_password"}}</label> - <input id="bind_password" name="bind_password" type="password" value="{{.bind_password}}"> - <p class="help text red">{{.i18n.Tr "admin.auths.bind_password_helper"}}</p> - </div> - <div class="ldap required field {{if not (eq .type 2)}}hide{{end}}"> - <label for="user_base">{{.i18n.Tr "admin.auths.user_base"}}</label> - <input id="user_base" name="user_base" value="{{.user_base}}" placeholder="e.g. ou=Users,dc=mydomain,dc=com"> - </div> - <div class="dldap required field {{if not (eq .type 5)}}hide{{end}}"> - <label for="user_dn">{{.i18n.Tr "admin.auths.user_dn"}}</label> - <input id="user_dn" name="user_dn" value="{{.user_dn}}" placeholder="e.g. uid=%s,ou=Users,dc=mydomain,dc=com"> - </div> - <div class="required field"> - <label for="filter">{{.i18n.Tr "admin.auths.filter"}}</label> - <input id="filter" name="filter" value="{{.filter}}" placeholder="e.g. (&(objectClass=posixAccount)(uid=%s))"> - </div> - <div class="field"> - <label for="admin_filter">{{.i18n.Tr "admin.auths.admin_filter"}}</label> - <input id="admin_filter" name="admin_filter" value="{{.admin_filter}}"> - </div> - <div class="field"> - <label for="attribute_username">{{.i18n.Tr "admin.auths.attribute_username"}}</label> - <input id="attribute_username" name="attribute_username" value="{{.attribute_username}}" placeholder="{{.i18n.Tr "admin.auths.attribute_username_placeholder"}}"> - </div> - <div class="field"> - <label for="attribute_name">{{.i18n.Tr "admin.auths.attribute_name"}}</label> - <input id="attribute_name" name="attribute_name" value="{{.attribute_name}}"> - </div> - <div class="field"> - <label for="attribute_surname">{{.i18n.Tr "admin.auths.attribute_surname"}}</label> - <input id="attribute_surname" name="attribute_surname" value="{{.attribute_surname}}"> - </div> - <div class="required field"> - <label for="attribute_mail">{{.i18n.Tr "admin.auths.attribute_mail"}}</label> - <input id="attribute_mail" name="attribute_mail" value="{{.attribute_mail}}" placeholder="e.g. mail"> + <!-- LDAP and DLDAP --> + <div class="ldap dldap field {{if not (or (eq .type 2) (eq .type 5))}}hide{{end}}"> + <div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}"> + <label>{{.i18n.Tr "admin.auths.security_protocol"}}</label> + <div class="ui selection security-protocol dropdown"> + <input type="hidden" id="security_protocol" name="security_protocol" value="{{.security_protocol}}"> + <div class="text">{{.CurrentSecurityProtocol}}</div> + <i class="dropdown icon"></i> + <div class="menu"> + {{range .SecurityProtocols}} + <div class="item" data-value="{{.Type}}">{{.Name}}</div> + {{end}} </div> </div> + </div> + <div class="required field"> + <label for="host">{{.i18n.Tr "admin.auths.host"}}</label> + <input id="host" name="host" value="{{.host}}" placeholder="e.g. mydomain.com"> + </div> + <div class="required field"> + <label for="port">{{.i18n.Tr "admin.auths.port"}}</label> + <input id="port" name="port" value="{{.port}}" placeholder="e.g. 636"> + </div> + <div class="ldap field {{if not (eq .type 2)}}hide{{end}}"> + <label for="bind_dn">{{.i18n.Tr "admin.auths.bind_dn"}}</label> + <input id="bind_dn" name="bind_dn" value="{{.bind_dn}}" placeholder="e.g. cn=Search,dc=mydomain,dc=com"> + </div> + <input class="fake" type="password"> + <div class="ldap field {{if not (eq .type 2)}}hide{{end}}"> + <label for="bind_password">{{.i18n.Tr "admin.auths.bind_password"}}</label> + <input id="bind_password" name="bind_password" type="password" value="{{.bind_password}}"> + <p class="help text red">{{.i18n.Tr "admin.auths.bind_password_helper"}}</p> + </div> + <div class="ldap required field {{if not (eq .type 2)}}hide{{end}}"> + <label for="user_base">{{.i18n.Tr "admin.auths.user_base"}}</label> + <input id="user_base" name="user_base" value="{{.user_base}}" placeholder="e.g. ou=Users,dc=mydomain,dc=com"> + </div> + <div class="dldap required field {{if not (eq .type 5)}}hide{{end}}"> + <label for="user_dn">{{.i18n.Tr "admin.auths.user_dn"}}</label> + <input id="user_dn" name="user_dn" value="{{.user_dn}}" placeholder="e.g. uid=%s,ou=Users,dc=mydomain,dc=com"> + </div> + <div class="required field"> + <label for="filter">{{.i18n.Tr "admin.auths.filter"}}</label> + <input id="filter" name="filter" value="{{.filter}}" placeholder="e.g. (&(objectClass=posixAccount)(uid=%s))"> + </div> + <div class="field"> + <label for="admin_filter">{{.i18n.Tr "admin.auths.admin_filter"}}</label> + <input id="admin_filter" name="admin_filter" value="{{.admin_filter}}"> + </div> + <div class="field"> + <label for="attribute_username">{{.i18n.Tr "admin.auths.attribute_username"}}</label> + <input id="attribute_username" name="attribute_username" value="{{.attribute_username}}" placeholder="{{.i18n.Tr "admin.auths.attribute_username_placeholder"}}"> + </div> + <div class="field"> + <label for="attribute_name">{{.i18n.Tr "admin.auths.attribute_name"}}</label> + <input id="attribute_name" name="attribute_name" value="{{.attribute_name}}"> + </div> + <div class="field"> + <label for="attribute_surname">{{.i18n.Tr "admin.auths.attribute_surname"}}</label> + <input id="attribute_surname" name="attribute_surname" value="{{.attribute_surname}}"> + </div> + <div class="required field"> + <label for="attribute_mail">{{.i18n.Tr "admin.auths.attribute_mail"}}</label> + <input id="attribute_mail" name="attribute_mail" value="{{.attribute_mail}}" placeholder="e.g. mail"> + </div> + </div> - <!-- SMTP --> - <div class="smtp field {{if not (eq .type 3)}}hide{{end}}"> - <div class="inline required field"> - <label>{{.i18n.Tr "admin.auths.smtp_auth"}}</label> - <div class="ui selection type dropdown"> - <input type="hidden" id="smtp_auth" name="smtp_auth" value="{{.smtp_auth}}"> - <div class="text">{{.smtp_auth}}</div> - <i class="dropdown icon"></i> - <div class="menu"> - {{range .SMTPAuths}} - <div class="item" data-value="{{.}}">{{.}}</div> - {{end}} - </div> - </div> - </div> - <div class="required field"> - <label for="smtp_host">{{.i18n.Tr "admin.auths.smtphost"}}</label> - <input id="smtp_host" name="smtp_host" value="{{.smtp_host}}"> - </div> - <div class="required field"> - <label for="smtp_port">{{.i18n.Tr "admin.auths.smtpport"}}</label> - <input id="smtp_port" name="smtp_port" value="{{.smtp_port}}"> - </div> - <div class="field"> - <label for="allowed_domains">{{.i18n.Tr "admin.auths.allowed_domains"}}</label> - <input id="allowed_domains" name="allowed_domains" value="{{.allowed_domains}}"> - <p class="help">{{.i18n.Tr "admin.auths.allowed_domains_helper"}}</p> + <!-- SMTP --> + <div class="smtp field {{if not (eq .type 3)}}hide{{end}}"> + <div class="inline required field"> + <label>{{.i18n.Tr "admin.auths.smtp_auth"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="smtp_auth" name="smtp_auth" value="{{.smtp_auth}}"> + <div class="text">{{.smtp_auth}}</div> + <i class="dropdown icon"></i> + <div class="menu"> + {{range .SMTPAuths}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} </div> </div> + </div> + <div class="required field"> + <label for="smtp_host">{{.i18n.Tr "admin.auths.smtphost"}}</label> + <input id="smtp_host" name="smtp_host" value="{{.smtp_host}}"> + </div> + <div class="required field"> + <label for="smtp_port">{{.i18n.Tr "admin.auths.smtpport"}}</label> + <input id="smtp_port" name="smtp_port" value="{{.smtp_port}}"> + </div> + <div class="field"> + <label for="allowed_domains">{{.i18n.Tr "admin.auths.allowed_domains"}}</label> + <input id="allowed_domains" name="allowed_domains" value="{{.allowed_domains}}"> + <p class="help">{{.i18n.Tr "admin.auths.allowed_domains_helper"}}</p> + </div> + </div> - <!-- PAM --> - <div class="pam required field {{if not (eq .type 4)}}hide{{end}}"> - <label for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label> - <input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}" /> - </div> - - <!-- OAuth2 --> - <div class="oauth2 field {{if not (eq .type 6)}}hide{{end}}"> - <div class="inline required field"> - <label>{{.i18n.Tr "admin.auths.oauth2_provider"}}</label> - <div class="ui selection type dropdown"> - <input type="hidden" id="oauth2_provider" name="oauth2_provider" value="{{.oauth2_provider}}"> - <div class="text">{{.oauth2_provider}}</div> - <i class="dropdown icon"></i> - <div class="menu"> - {{range $key, $value := .OAuth2Providers}} - <div class="item" data-value="{{$key}}">{{$value.DisplayName}}</div> - {{end}} - </div> - </div> - </div> - <div class="required field"> - <label for="oauth2_key">{{.i18n.Tr "admin.auths.oauth2_clientID"}}</label> - <input id="oauth2_key" name="oauth2_key" value="{{.oauth2_key}}"> - </div> - <div class="required field"> - <label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label> - <input id="oauth2_secret" name="oauth2_secret" value="{{.oauth2_secret}}"> - </div> - </div> + <!-- PAM --> + <div class="pam required field {{if not (eq .type 4)}}hide{{end}}"> + <label for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label> + <input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}" /> + </div> - <div class="ldap field"> - <div class="ui checkbox"> - <label><strong>{{.i18n.Tr "admin.auths.attributes_in_bind"}}</strong></label> - <input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}> - </div> - </div> - <div class="smtp inline field {{if not (eq .type 3)}}hide{{end}}"> - <div class="ui checkbox"> - <label><strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong></label> - <input name="tls" type="checkbox" {{if .tls}}checked{{end}}> - </div> - </div> - <div class="has-tls inline field {{if not .HasTLS}}hide{{end}}"> - <div class="ui checkbox"> - <label><strong>{{.i18n.Tr "admin.auths.skip_tls_verify"}}</strong></label> - <input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}> - </div> - </div> - <div class="inline field"> - <div class="ui checkbox"> - <label><strong>{{.i18n.Tr "admin.auths.activated"}}</strong></label> - <input name="is_active" type="checkbox" {{if .is_active}}checked{{end}}> + <!-- OAuth2 --> + <div class="oauth2 field {{if not (eq .type 6)}}hide{{end}}"> + <div class="inline required field"> + <label>{{.i18n.Tr "admin.auths.oauth2_provider"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="oauth2_provider" name="oauth2_provider" value="{{.oauth2_provider}}"> + <div class="text">{{.oauth2_provider}}</div> + <i class="dropdown icon"></i> + <div class="menu"> + {{range $key, $value := .OAuth2Providers}} + <div class="item" data-value="{{$key}}">{{$value.DisplayName}}</div> + {{end}} </div> </div> + </div> + <div class="required field"> + <label for="oauth2_key">{{.i18n.Tr "admin.auths.oauth2_clientID"}}</label> + <input id="oauth2_key" name="oauth2_key" value="{{.oauth2_key}}"> + </div> + <div class="required field"> + <label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label> + <input id="oauth2_secret" name="oauth2_secret" value="{{.oauth2_secret}}"> + </div> + </div> - <div class="field"> - <button class="ui green button">{{.i18n.Tr "admin.auths.new"}}</button> - </div> - </form> + <div class="ldap field"> + <div class="ui checkbox"> + <label><strong>{{.i18n.Tr "admin.auths.attributes_in_bind"}}</strong></label> + <input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}> + </div> + </div> + <div class="smtp inline field {{if not (eq .type 3)}}hide{{end}}"> + <div class="ui checkbox"> + <label><strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong></label> + <input name="tls" type="checkbox" {{if .tls}}checked{{end}}> + </div> + </div> + <div class="has-tls inline field {{if not .HasTLS}}hide{{end}}"> + <div class="ui checkbox"> + <label><strong>{{.i18n.Tr "admin.auths.skip_tls_verify"}}</strong></label> + <input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{.i18n.Tr "admin.auths.activated"}}</strong></label> + <input name="is_active" type="checkbox" {{if .is_active}}checked{{end}}> + </div> </div> - <h4 class="ui top attached header"> - {{.i18n.Tr "admin.auths.tips"}} - </h4> - <div class="ui attached segment"> - <h5>GMail Settings:</h5> - <p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p> - <h5>OAuth GitHub:</h5> - <p>{{.i18n.Tr "admin.auths.tip.github"}}</p> + <div class="field"> + <button class="ui green button">{{.i18n.Tr "admin.auths.new"}}</button> </div> - </div> + </form> + </div> + + <h4 class="ui top attached header"> + {{.i18n.Tr "admin.auths.tips"}} + </h4> + <div class="ui attached segment"> + <h5>GMail Settings:</h5> + <p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p> + <h5>OAuth GitHub:</h5> + <p>{{.i18n.Tr "admin.auths.tip.github"}}</p> </div> </div> </div> |