edit.tmpl 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. </div>
  53. <input class="fake" type="password">
  54. <div class="field">
  55. <label for="bind_password">{{.i18n.Tr "admin.auths.bind_password"}}</label>
  56. <input id="bind_password" name="bind_password" type="password" value="{{$cfg.BindPassword}}">
  57. <p class="help text red">{{.i18n.Tr "admin.auths.bind_password_helper"}}</p>
  58. </div>
  59. <div class="required field">
  60. <label for="user_base">{{.i18n.Tr "admin.auths.user_base"}}</label>
  61. <input id="user_base" name="user_base" value="{{$cfg.UserBase}}" placeholder="e.g. ou=Users,dc=mydomain,dc=com" required>
  62. </div>
  63. {{end}}
  64. {{if .Source.IsDLDAP}}
  65. <div class="required field">
  66. <label for="user_dn">{{.i18n.Tr "admin.auths.user_dn"}}</label>
  67. <input id="user_dn" name="user_dn" value="{{$cfg.UserDN}}" placeholder="e.g. uid=%s,ou=Users,dc=mydomain,dc=com" required>
  68. </div>
  69. {{end}}
  70. <div class="required field">
  71. <label for="filter">{{.i18n.Tr "admin.auths.filter"}}</label>
  72. <input id="filter" name="filter" value="{{$cfg.Filter}}" placeholder="e.g. (&(objectClass=posixAccount)(uid=%s))" required>
  73. </div>
  74. <div class="field">
  75. <label for="admin_filter">{{.i18n.Tr "admin.auths.admin_filter"}}</label>
  76. <input id="admin_filter" name="admin_filter" value="{{$cfg.AdminFilter}}">
  77. </div>
  78. <div class="field">
  79. <label for="attribute_username">{{.i18n.Tr "admin.auths.attribute_username"}}</label>
  80. <input id="attribute_username" name="attribute_username" value="{{$cfg.AttributeUsername}}" placeholder="{{.i18n.Tr "admin.auths.attribute_username_placeholder"}}">
  81. </div>
  82. <div class="field">
  83. <label for="attribute_name">{{.i18n.Tr "admin.auths.attribute_name"}}</label>
  84. <input id="attribute_name" name="attribute_name" value="{{$cfg.AttributeName}}">
  85. </div>
  86. <div class="field">
  87. <label for="attribute_surname">{{.i18n.Tr "admin.auths.attribute_surname"}}</label>
  88. <input id="attribute_surname" name="attribute_surname" value="{{$cfg.AttributeSurname}}">
  89. </div>
  90. <div class="required field">
  91. <label for="attribute_mail">{{.i18n.Tr "admin.auths.attribute_mail"}}</label>
  92. <input id="attribute_mail" name="attribute_mail" value="{{$cfg.AttributeMail}}" placeholder="e.g. mail" required>
  93. </div>
  94. <div class="inline field">
  95. <div class="ui checkbox">
  96. <label><strong>{{.i18n.Tr "admin.auths.verify_group_membership"}}</strong></label>
  97. <input class="enable-system" type="checkbox" name="group_enabled" data-target="#group_box" {{if $cfg.GroupEnabled}}checked{{end}}>
  98. </div>
  99. </div>
  100. <div class="ui segment field {{if not $cfg.GroupEnabled}}disabled{{end}}" id="group_box">
  101. <div class="field">
  102. <label for="group_dn">{{.i18n.Tr "admin.auths.group_search_base_dn"}}</label>
  103. <input id="group_dn" name="group_dn" value="{{$cfg.GroupDN}}" placeholder="e.g. ou=group,dc=mydomain,dc=com">
  104. </div>
  105. <div class="field">
  106. <label for="group_filter">{{.i18n.Tr "admin.auths.group_filter"}}</label>
  107. <input id="group_filter" name="group_filter" value="{{$cfg.GroupFilter}}" placeholder="e.g. (|(cn=gogs_users)(cn=admins))">
  108. </div>
  109. <div class="field">
  110. <label for="group_member_uid">{{.i18n.Tr "admin.auths.group_attribute_contain_user_list"}}</label>
  111. <input id="group_member_uid" name="group_member_uid" value="{{$cfg.GroupMemberUID}}" placeholder="e.g. memberUid">
  112. </div>
  113. <div class="field">
  114. <label for="user_uid">{{.i18n.Tr "admin.auths.user_attribute_listed_in_group"}}</label>
  115. <input id="user_uid" name="user_uid" value="{{$cfg.UserUID}}" placeholder="e.g. uid">
  116. </div>
  117. </div>
  118. {{if .Source.IsLDAP}}
  119. <div class="inline field">
  120. <div class="ui checkbox">
  121. <label><strong>{{.i18n.Tr "admin.auths.attributes_in_bind"}}</strong></label>
  122. <input name="attributes_in_bind" type="checkbox" {{if $cfg.AttributesInBind}}checked{{end}}>
  123. </div>
  124. </div>
  125. {{end}}
  126. {{end}}
  127. <!-- SMTP -->
  128. {{if .Source.IsSMTP}}
  129. {{ $cfg:=.Source.SMTP }}
  130. <div class="inline required field">
  131. <label>{{.i18n.Tr "admin.auths.smtp_auth"}}</label>
  132. <div class="ui selection type dropdown">
  133. <input type="hidden" id="smtp_auth" name="smtp_auth" value="{{$cfg.Auth}}" required>
  134. <div class="text">{{$cfg.Auth}}</div>
  135. <i class="dropdown icon"></i>
  136. <div class="menu">
  137. {{range .SMTPAuths}}
  138. <div class="item" data-value="{{.}}">{{.}}</div>
  139. {{end}}
  140. </div>
  141. </div>
  142. </div>
  143. <div class="required field">
  144. <label for="smtp_host">{{.i18n.Tr "admin.auths.smtphost"}}</label>
  145. <input id="smtp_host" name="smtp_host" value="{{$cfg.Host}}" required>
  146. </div>
  147. <div class="required field">
  148. <label for="smtp_port">{{.i18n.Tr "admin.auths.smtpport"}}</label>
  149. <input id="smtp_port" name="smtp_port" value="{{$cfg.Port}}" required>
  150. </div>
  151. <div class="field">
  152. <label for="allowed_domains">{{.i18n.Tr "admin.auths.allowed_domains"}}</label>
  153. <input id="allowed_domains" name="allowed_domains" value="{{$cfg.AllowedDomains}}">
  154. <p class="help">{{.i18n.Tr "admin.auths.allowed_domains_helper"}}</p>
  155. </div>
  156. {{end}}
  157. <!-- PAM -->
  158. {{if .Source.IsPAM}}
  159. {{ $cfg:=.Source.PAM }}
  160. <div class="required field">
  161. <label for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label>
  162. <input id="pam_service_name" name="pam_service_name" value="{{$cfg.ServiceName}}" required>
  163. </div>
  164. {{end}}
  165. <div class="inline field {{if not .Source.IsSMTP}}hide{{end}}">
  166. <div class="ui checkbox">
  167. <label><strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong></label>
  168. <input name="tls" type="checkbox" {{if .Source.UseTLS}}checked{{end}}>
  169. </div>
  170. </div>
  171. <div class="has-tls inline field {{if not .HasTLS}}hide{{end}}">
  172. <div class="ui checkbox">
  173. <label><strong>{{.i18n.Tr "admin.auths.skip_tls_verify"}}</strong></label>
  174. <input name="skip_verify" type="checkbox" {{if .Source.SkipVerify}}checked{{end}}>
  175. </div>
  176. </div>
  177. <div class="inline field">
  178. <div class="ui checkbox">
  179. <label><strong>{{.i18n.Tr "admin.auths.activated"}}</strong></label>
  180. <input name="is_active" type="checkbox" {{if .Source.IsActived}}checked{{end}}>
  181. </div>
  182. </div>
  183. <div class="field">
  184. <button class="ui green button">{{.i18n.Tr "admin.auths.update"}}</button>
  185. <div class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.Source.ID}}">{{.i18n.Tr "admin.auths.delete"}}</div>
  186. </div>
  187. </form>
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192. </div>
  193. <div class="ui small basic delete modal">
  194. <div class="ui icon header">
  195. <i class="trash icon"></i>
  196. {{.i18n.Tr "admin.auths.delete_auth_title"}}
  197. </div>
  198. <div class="content">
  199. <p>{{.i18n.Tr "admin.auths.delete_auth_desc"}}</p>
  200. </div>
  201. {{template "base/delete_modal_actions" .}}
  202. </div>
  203. {{template "base/footer" .}}