new.tmpl 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. {{template "base/head" .}}
  2. <div class="admin new 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.new"}}
  10. </h4>
  11. <div class="ui attached segment">
  12. <form class="ui form" action="{{.Link}}" method="post">
  13. {{.CSRFTokenHTML}}
  14. <!-- Types and name -->
  15. <div class="inline required field {{if .Err_Type}}error{{end}}">
  16. <label>{{.i18n.Tr "admin.auths.auth_type"}}</label>
  17. <div class="ui selection type dropdown">
  18. <input type="hidden" id="auth_type" name="type" value="{{.type}}">
  19. <div class="text">{{.CurrentTypeName}}</div>
  20. <i class="dropdown icon"></i>
  21. <div class="menu">
  22. {{range .AuthSources}}
  23. <div class="item" data-value="{{.Type}}">{{.Name}}</div>
  24. {{end}}
  25. </div>
  26. </div>
  27. </div>
  28. <div class="required inline field {{if .Err_Name}}error{{end}}">
  29. <label for="name">{{.i18n.Tr "admin.auths.auth_name"}}</label>
  30. <input id="name" name="name" value="{{.name}}" autofocus required>
  31. </div>
  32. <!-- LDAP and DLDAP -->
  33. <div class="ldap dldap field {{if not (or (eq .type 2) (eq .type 5))}}hide{{end}}">
  34. <div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}">
  35. <label>{{.i18n.Tr "admin.auths.security_protocol"}}</label>
  36. <div class="ui selection security-protocol dropdown">
  37. <input type="hidden" id="security_protocol" name="security_protocol" value="{{.security_protocol}}">
  38. <div class="text">{{.CurrentSecurityProtocol}}</div>
  39. <i class="dropdown icon"></i>
  40. <div class="menu">
  41. {{range .SecurityProtocols}}
  42. <div class="item" data-value="{{.Type}}">{{.Name}}</div>
  43. {{end}}
  44. </div>
  45. </div>
  46. </div>
  47. <div class="required field">
  48. <label for="host">{{.i18n.Tr "admin.auths.host"}}</label>
  49. <input id="host" name="host" value="{{.host}}" placeholder="e.g. mydomain.com">
  50. </div>
  51. <div class="required field">
  52. <label for="port">{{.i18n.Tr "admin.auths.port"}}</label>
  53. <input id="port" name="port" value="{{.port}}" placeholder="e.g. 636">
  54. </div>
  55. <div class="ldap field {{if not (eq .type 2)}}hide{{end}}">
  56. <label for="bind_dn">{{.i18n.Tr "admin.auths.bind_dn"}}</label>
  57. <input id="bind_dn" name="bind_dn" value="{{.bind_dn}}" placeholder="e.g. cn=Search,dc=mydomain,dc=com">
  58. </div>
  59. <div class="ldap field {{if not (eq .type 2)}}hide{{end}}">
  60. <label for="bind_password">{{.i18n.Tr "admin.auths.bind_password"}}</label>
  61. <input id="bind_password" name="bind_password" type="password" value="{{.bind_password}}">
  62. <p class="help text red">{{.i18n.Tr "admin.auths.bind_password_helper"}}</p>
  63. </div>
  64. <div class="ldap required field {{if not (eq .type 2)}}hide{{end}}">
  65. <label for="user_base">{{.i18n.Tr "admin.auths.user_base"}}</label>
  66. <input id="user_base" name="user_base" value="{{.user_base}}" placeholder="e.g. ou=Users,dc=mydomain,dc=com">
  67. </div>
  68. <div class="dldap required field {{if not (eq .type 5)}}hide{{end}}">
  69. <label for="user_dn">{{.i18n.Tr "admin.auths.user_dn"}}</label>
  70. <input id="user_dn" name="user_dn" value="{{.user_dn}}" placeholder="e.g. uid=%s,ou=Users,dc=mydomain,dc=com">
  71. </div>
  72. <div class="required field">
  73. <label for="filter">{{.i18n.Tr "admin.auths.filter"}}</label>
  74. <input id="filter" name="filter" value="{{.filter}}" placeholder="e.g. (&(objectClass=posixAccount)(uid=%s))">
  75. </div>
  76. <div class="field">
  77. <label for="admin_filter">{{.i18n.Tr "admin.auths.admin_filter"}}</label>
  78. <input id="admin_filter" name="admin_filter" value="{{.admin_filter}}">
  79. </div>
  80. <div class="field">
  81. <label for="attribute_username">{{.i18n.Tr "admin.auths.attribute_username"}}</label>
  82. <input id="attribute_username" name="attribute_username" value="{{.attribute_username}}" placeholder="{{.i18n.Tr "admin.auths.attribute_username_placeholder"}}">
  83. </div>
  84. <div class="field">
  85. <label for="attribute_name">{{.i18n.Tr "admin.auths.attribute_name"}}</label>
  86. <input id="attribute_name" name="attribute_name" value="{{.attribute_name}}">
  87. </div>
  88. <div class="field">
  89. <label for="attribute_surname">{{.i18n.Tr "admin.auths.attribute_surname"}}</label>
  90. <input id="attribute_surname" name="attribute_surname" value="{{.attribute_surname}}">
  91. </div>
  92. <div class="required field">
  93. <label for="attribute_mail">{{.i18n.Tr "admin.auths.attribute_mail"}}</label>
  94. <input id="attribute_mail" name="attribute_mail" value="{{.attribute_mail}}" placeholder="e.g. mail">
  95. </div>
  96. <div class="inline field">
  97. <div class="ui checkbox">
  98. <label><strong>{{.i18n.Tr "admin.auths.verify_group_membership"}}</strong></label>
  99. <input class="enable-system" type="checkbox" name="group_enabled" data-target="#group_box" {{if .group_enabled}}checked{{end}}>
  100. </div>
  101. </div>
  102. <div class="ui segment field {{if not .group_enabled}}disabled{{end}}" id="group_box">
  103. <div class="field">
  104. <label for="group_dn">{{.i18n.Tr "admin.auths.group_search_base_dn"}}</label>
  105. <input id="group_dn" name="group_dn" value="{{.group_dn}}" placeholder="e.g. ou=group,dc=mydomain,dc=com">
  106. </div>
  107. <div class="field">
  108. <label for="group_filter">{{.i18n.Tr "admin.auths.group_filter"}}</label>
  109. <input id="group_filter" name="group_filter" value="{{.group_filter}}" placeholder="e.g. (|(cn=gogs_users)(cn=admins))">
  110. </div>
  111. <div class="field">
  112. <label for="group_member_uid">{{.i18n.Tr "admin.auths.group_attribute_contain_user_list"}}</label>
  113. <input id="group_member_uid" name="group_member_uid" value="{{.group_member_uid}}" placeholder="e.g. memberUid">
  114. </div>
  115. <div class="field">
  116. <label for="user_uid">{{.i18n.Tr "admin.auths.user_attribute_listed_in_group"}}</label>
  117. <input id="user_uid" name="user_uid" value="{{.user_uid}}" placeholder="e.g. uid">
  118. </div>
  119. </div>
  120. </div>
  121. <!-- SMTP -->
  122. <div class="smtp field {{if not (eq .type 3)}}hide{{end}}">
  123. <div class="inline required field">
  124. <label>{{.i18n.Tr "admin.auths.smtp_auth"}}</label>
  125. <div class="ui selection type dropdown">
  126. <input type="hidden" id="smtp_auth" name="smtp_auth" value="{{.smtp_auth}}">
  127. <div class="text">{{.smtp_auth}}</div>
  128. <i class="dropdown icon"></i>
  129. <div class="menu">
  130. {{range .SMTPAuths}}
  131. <div class="item" data-value="{{.}}">{{.}}</div>
  132. {{end}}
  133. </div>
  134. </div>
  135. </div>
  136. <div class="required field">
  137. <label for="smtp_host">{{.i18n.Tr "admin.auths.smtphost"}}</label>
  138. <input id="smtp_host" name="smtp_host" value="{{.smtp_host}}">
  139. </div>
  140. <div class="required field">
  141. <label for="smtp_port">{{.i18n.Tr "admin.auths.smtpport"}}</label>
  142. <input id="smtp_port" name="smtp_port" value="{{.smtp_port}}">
  143. </div>
  144. <div class="field">
  145. <label for="allowed_domains">{{.i18n.Tr "admin.auths.allowed_domains"}}</label>
  146. <input id="allowed_domains" name="allowed_domains" value="{{.allowed_domains}}">
  147. <p class="help">{{.i18n.Tr "admin.auths.allowed_domains_helper"}}</p>
  148. </div>
  149. </div>
  150. <!-- PAM -->
  151. <div class="pam required field {{if not (eq .type 4)}}hide{{end}}">
  152. <label for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label>
  153. <input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}" />
  154. </div>
  155. <div class="ldap field">
  156. <div class="ui checkbox">
  157. <label><strong>{{.i18n.Tr "admin.auths.attributes_in_bind"}}</strong></label>
  158. <input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}>
  159. </div>
  160. </div>
  161. <div class="smtp inline field {{if not (eq .type 3)}}hide{{end}}">
  162. <div class="ui checkbox">
  163. <label><strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong></label>
  164. <input name="tls" type="checkbox" {{if .tls}}checked{{end}}>
  165. </div>
  166. </div>
  167. <div class="has-tls inline field {{if not .HasTLS}}hide{{end}}">
  168. <div class="ui checkbox">
  169. <label><strong>{{.i18n.Tr "admin.auths.skip_tls_verify"}}</strong></label>
  170. <input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}>
  171. </div>
  172. </div>
  173. <div class="inline field">
  174. <div class="ui checkbox">
  175. <label><strong>{{.i18n.Tr "admin.auths.activated"}}</strong></label>
  176. <input name="is_active" type="checkbox" {{if .is_active}}checked{{end}}>
  177. </div>
  178. </div>
  179. <div class="field">
  180. <button class="ui green button">{{.i18n.Tr "admin.auths.new"}}</button>
  181. </div>
  182. </form>
  183. </div>
  184. <h4 class="ui top attached header">
  185. {{.i18n.Tr "admin.auths.tips"}}
  186. </h4>
  187. <div class="ui attached segment">
  188. <h5>GMail Settings:</h5>
  189. <p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p>
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. {{template "base/footer" .}}