edit.tmpl 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. {{template "base/head" .}}
  2. <div class="admin edit authentication">
  3. <div class="ui container">
  4. <div class="ui grid">
  5. {{template "admin/navbar" .}}
  6. <div class="twelve wide column content">
  7. {{template "base/alert" .}}
  8. <h4 class="ui top attached header">
  9. {{.i18n.Tr "admin.auths.edit"}}
  10. </h4>
  11. <div class="ui attached segment">
  12. <form class="ui form" action="{{.Link}}" method="post">
  13. {{.CSRFTokenHTML}}
  14. <input type="hidden" name="id" value="{{.Source.ID}}">
  15. <div class="inline field">
  16. <label>{{$.i18n.Tr "admin.auths.auth_type"}}</label>
  17. <input type="hidden" id="auth_type" name="type" value="{{.Source.Type}}">
  18. <span>{{.Source.TypeName}}</span>
  19. </div>
  20. <div class="required inline field {{if .Err_Name}}error{{end}}">
  21. <label for="name">{{.i18n.Tr "admin.auths.auth_name"}}</label>
  22. <input id="name" name="name" value="{{.Source.Name}}" autofocus required>
  23. </div>
  24. <!-- LDAP and DLDAP -->
  25. {{if or .Source.IsLDAP .Source.IsDLDAP}}
  26. {{ $cfg:=.Source.LDAP }}
  27. <div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}">
  28. <label>{{.i18n.Tr "admin.auths.security_protocol"}}</label>
  29. <div class="ui selection security-protocol dropdown">
  30. <input type="hidden" id="security_protocol" name="security_protocol" value="{{$cfg.SecurityProtocol}}">
  31. <div class="text">{{$cfg.SecurityProtocolName}}</div>
  32. <i class="dropdown icon"></i>
  33. <div class="menu">
  34. {{range .SecurityProtocols}}
  35. <div class="item" data-value="{{.Type}}">{{.Name}}</div>
  36. {{end}}
  37. </div>
  38. </div>
  39. </div>
  40. <div class="required field">
  41. <label for="host">{{.i18n.Tr "admin.auths.host"}}</label>
  42. <input id="host" name="host" value="{{$cfg.Host}}" placeholder="e.g. mydomain.com" required>
  43. </div>
  44. <div class="required field">
  45. <label for="port">{{.i18n.Tr "admin.auths.port"}}</label>
  46. <input id="port" name="port" value="{{$cfg.Port}}" placeholder="e.g. 636" required>
  47. </div>
  48. {{if .Source.IsLDAP}}
  49. <div class="field">
  50. <label for="bind_dn">{{.i18n.Tr "admin.auths.bind_dn"}}</label>
  51. <input id="bind_dn" name="bind_dn" value="{{$cfg.BindDN}}" placeholder="e.g. cn=Search,dc=mydomain,dc=com">
  52. <p class="help text red">{{.i18n.Tr "admin.auths.bind_dn_helper"}}</p>
  53. </div>
  54. <input class="fake" type="password">
  55. <div class="field">
  56. <label for="bind_password">{{.i18n.Tr "admin.auths.bind_password"}}</label>
  57. <input id="bind_password" name="bind_password" type="password" value="{{$cfg.BindPassword}}">
  58. <p class="help text red">{{.i18n.Tr "admin.auths.bind_password_helper"}}</p>
  59. </div>
  60. <div class="required field">
  61. <label for="user_base">{{.i18n.Tr "admin.auths.user_base"}}</label>
  62. <input id="user_base" name="user_base" value="{{$cfg.UserBase}}" placeholder="e.g. ou=Users,dc=mydomain,dc=com" required>
  63. </div>
  64. {{end}}
  65. {{if .Source.IsDLDAP}}
  66. <div class="required field">
  67. <label for="user_dn">{{.i18n.Tr "admin.auths.user_dn"}}</label>
  68. <input id="user_dn" name="user_dn" value="{{$cfg.UserDN}}" placeholder="e.g. uid=%s,ou=Users,dc=mydomain,dc=com" required>
  69. </div>
  70. {{end}}
  71. <div class="required field">
  72. <label for="filter">{{.i18n.Tr "admin.auths.filter"}}</label>
  73. <input id="filter" name="filter" value="{{$cfg.Filter}}" placeholder="e.g. (&(objectClass=posixAccount)(uid=%s))" required>
  74. </div>
  75. <div class="field">
  76. <label for="admin_filter">{{.i18n.Tr "admin.auths.admin_filter"}}</label>
  77. <input id="admin_filter" name="admin_filter" value="{{$cfg.AdminFilter}}">
  78. </div>
  79. <div class="field">
  80. <label for="attribute_username">{{.i18n.Tr "admin.auths.attribute_username"}}</label>
  81. <input id="attribute_username" name="attribute_username" value="{{$cfg.AttributeUsername}}" placeholder="{{.i18n.Tr "admin.auths.attribute_username_placeholder"}}">
  82. </div>
  83. <div class="field">
  84. <label for="attribute_name">{{.i18n.Tr "admin.auths.attribute_name"}}</label>
  85. <input id="attribute_name" name="attribute_name" value="{{$cfg.AttributeName}}">
  86. </div>
  87. <div class="field">
  88. <label for="attribute_surname">{{.i18n.Tr "admin.auths.attribute_surname"}}</label>
  89. <input id="attribute_surname" name="attribute_surname" value="{{$cfg.AttributeSurname}}">
  90. </div>
  91. <div class="required field">
  92. <label for="attribute_mail">{{.i18n.Tr "admin.auths.attribute_mail"}}</label>
  93. <input id="attribute_mail" name="attribute_mail" value="{{$cfg.AttributeMail}}" placeholder="e.g. mail" required>
  94. </div>
  95. <div class="inline field">
  96. <div class="ui checkbox">
  97. <label><strong>{{.i18n.Tr "admin.auths.verify_group_membership"}}</strong></label>
  98. <input class="enable-system" type="checkbox" name="group_enabled" data-target="#group_box" {{if $cfg.GroupEnabled}}checked{{end}}>
  99. </div>
  100. </div>
  101. <div class="ui segment field {{if not $cfg.GroupEnabled}}disabled{{end}}" id="group_box">
  102. <div class="field">
  103. <label for="group_dn">{{.i18n.Tr "admin.auths.group_search_base_dn"}}</label>
  104. <input id="group_dn" name="group_dn" value="{{$cfg.GroupDN}}" placeholder="e.g. ou=group,dc=mydomain,dc=com">
  105. </div>
  106. <div class="field">
  107. <label for="group_filter">{{.i18n.Tr "admin.auths.group_filter"}}</label>
  108. <input id="group_filter" name="group_filter" value="{{$cfg.GroupFilter}}" placeholder="e.g. (|(cn=gogs_users)(cn=admins))">
  109. </div>
  110. <div class="field">
  111. <label for="group_member_uid">{{.i18n.Tr "admin.auths.group_attribute_contain_user_list"}}</label>
  112. <input id="group_member_uid" name="group_member_uid" value="{{$cfg.GroupMemberUID}}" placeholder="e.g. memberUid">
  113. </div>
  114. <div class="field">
  115. <label for="user_uid">{{.i18n.Tr "admin.auths.user_attribute_listed_in_group"}}</label>
  116. <input id="user_uid" name="user_uid" value="{{$cfg.UserUID}}" placeholder="e.g. uid">
  117. </div>
  118. </div>
  119. {{if .Source.IsLDAP}}
  120. <div class="inline field">
  121. <div class="ui checkbox">
  122. <label><strong>{{.i18n.Tr "admin.auths.attributes_in_bind"}}</strong></label>
  123. <input name="attributes_in_bind" type="checkbox" {{if $cfg.AttributesInBind}}checked{{end}}>
  124. </div>
  125. </div>
  126. {{end}}
  127. {{end}}
  128. <!-- SMTP -->
  129. {{if .Source.IsSMTP}}
  130. {{ $cfg:=.Source.SMTP }}
  131. <div class="inline required field">
  132. <label>{{.i18n.Tr "admin.auths.smtp_auth"}}</label>
  133. <div class="ui selection type dropdown">
  134. <input type="hidden" id="smtp_auth" name="smtp_auth" value="{{$cfg.Auth}}" required>
  135. <div class="text">{{$cfg.Auth}}</div>
  136. <i class="dropdown icon"></i>
  137. <div class="menu">
  138. {{range .SMTPAuths}}
  139. <div class="item" data-value="{{.}}">{{.}}</div>
  140. {{end}}
  141. </div>
  142. </div>
  143. </div>
  144. <div class="required field">
  145. <label for="smtp_host">{{.i18n.Tr "admin.auths.smtphost"}}</label>
  146. <input id="smtp_host" name="smtp_host" value="{{$cfg.Host}}" required>
  147. </div>
  148. <div class="required field">
  149. <label for="smtp_port">{{.i18n.Tr "admin.auths.smtpport"}}</label>
  150. <input id="smtp_port" name="smtp_port" value="{{$cfg.Port}}" required>
  151. </div>
  152. <div class="field">
  153. <label for="allowed_domains">{{.i18n.Tr "admin.auths.allowed_domains"}}</label>
  154. <input id="allowed_domains" name="allowed_domains" value="{{$cfg.AllowedDomains}}">
  155. <p class="help">{{.i18n.Tr "admin.auths.allowed_domains_helper"}}</p>
  156. </div>
  157. {{end}}
  158. <!-- PAM -->
  159. {{if .Source.IsPAM}}
  160. {{ $cfg:=.Source.PAM }}
  161. <div class="required field">
  162. <label for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label>
  163. <input id="pam_service_name" name="pam_service_name" value="{{$cfg.ServiceName}}" required>
  164. </div>
  165. {{end}}
  166. <div class="inline field {{if not .Source.IsSMTP}}hide{{end}}">
  167. <div class="ui checkbox">
  168. <label><strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong></label>
  169. <input name="tls" type="checkbox" {{if .Source.UseTLS}}checked{{end}}>
  170. </div>
  171. </div>
  172. <div class="has-tls inline field {{if not .HasTLS}}hide{{end}}">
  173. <div class="ui checkbox">
  174. <label><strong>{{.i18n.Tr "admin.auths.skip_tls_verify"}}</strong></label>
  175. <input name="skip_verify" type="checkbox" {{if .Source.SkipVerify}}checked{{end}}>
  176. </div>
  177. </div>
  178. <div class="inline field">
  179. <div class="ui checkbox">
  180. <label><strong>{{.i18n.Tr "admin.auths.activated"}}</strong></label>
  181. <input name="is_active" type="checkbox" {{if .Source.IsActived}}checked{{end}}>
  182. </div>
  183. </div>
  184. <div class="inline field">
  185. <div class="ui checkbox">
  186. <label><strong>{{.i18n.Tr "admin.auths.default_auth"}}</strong></label>
  187. <input name="is_default" type="checkbox" {{if .Source.IsDefault}}checked{{end}}>
  188. </div>
  189. </div>
  190. <div class="field">
  191. <button class="ui green button">{{.i18n.Tr "admin.auths.update"}}</button>
  192. {{if not .Source.LocalFile}}
  193. <div class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.Source.ID}}">{{.i18n.Tr "admin.auths.delete"}}</div>
  194. {{end}}
  195. </div>
  196. </form>
  197. </div>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. <div class="ui small basic delete modal">
  203. <div class="ui icon header">
  204. <i class="trash icon"></i>
  205. {{.i18n.Tr "admin.auths.delete_auth_title"}}
  206. </div>
  207. <div class="content">
  208. <p>{{.i18n.Tr "admin.auths.delete_auth_desc"}}</p>
  209. </div>
  210. {{template "base/delete_modal_actions" .}}
  211. </div>
  212. {{template "base/footer" .}}