You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
8.1 KiB

  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. {{if .Source.IsLDAP}}
  95. <div class="inline field">
  96. <div class="ui checkbox">
  97. <label><strong>{{.i18n.Tr "admin.auths.attributes_in_bind"}}</strong></label>
  98. <input name="attributes_in_bind" type="checkbox" {{if $cfg.AttributesInBind}}checked{{end}}>
  99. </div>
  100. </div>
  101. {{end}}
  102. {{end}}
  103. <!-- SMTP -->
  104. {{if .Source.IsSMTP}}
  105. {{ $cfg:=.Source.SMTP }}
  106. <div class="inline required field">
  107. <label>{{.i18n.Tr "admin.auths.smtp_auth"}}</label>
  108. <div class="ui selection type dropdown">
  109. <input type="hidden" id="smtp_auth" name="smtp_auth" value="{{$cfg.Auth}}" required>
  110. <div class="text">{{$cfg.Auth}}</div>
  111. <i class="dropdown icon"></i>
  112. <div class="menu">
  113. {{range .SMTPAuths}}
  114. <div class="item" data-value="{{.}}">{{.}}</div>
  115. {{end}}
  116. </div>
  117. </div>
  118. </div>
  119. <div class="required field">
  120. <label for="smtp_host">{{.i18n.Tr "admin.auths.smtphost"}}</label>
  121. <input id="smtp_host" name="smtp_host" value="{{$cfg.Host}}" required>
  122. </div>
  123. <div class="required field">
  124. <label for="smtp_port">{{.i18n.Tr "admin.auths.smtpport"}}</label>
  125. <input id="smtp_port" name="smtp_port" value="{{$cfg.Port}}" required>
  126. </div>
  127. <div class="field">
  128. <label for="allowed_domains">{{.i18n.Tr "admin.auths.allowed_domains"}}</label>
  129. <input id="allowed_domains" name="allowed_domains" value="{{$cfg.AllowedDomains}}">
  130. <p class="help">{{.i18n.Tr "admin.auths.allowed_domains_helper"}}</p>
  131. </div>
  132. {{end}}
  133. <!-- PAM -->
  134. {{if .Source.IsPAM}}
  135. {{ $cfg:=.Source.PAM }}
  136. <div class="required field">
  137. <label for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label>
  138. <input id="pam_service_name" name="pam_service_name" value="{{$cfg.ServiceName}}" required>
  139. </div>
  140. {{end}}
  141. <div class="inline field {{if not .Source.IsSMTP}}hide{{end}}">
  142. <div class="ui checkbox">
  143. <label><strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong></label>
  144. <input name="tls" type="checkbox" {{if .Source.UseTLS}}checked{{end}}>
  145. </div>
  146. </div>
  147. <div class="has-tls inline field {{if not .HasTLS}}hide{{end}}">
  148. <div class="ui checkbox">
  149. <label><strong>{{.i18n.Tr "admin.auths.skip_tls_verify"}}</strong></label>
  150. <input name="skip_verify" type="checkbox" {{if .Source.SkipVerify}}checked{{end}}>
  151. </div>
  152. </div>
  153. <div class="inline field">
  154. <div class="ui checkbox">
  155. <label><strong>{{.i18n.Tr "admin.auths.activated"}}</strong></label>
  156. <input name="is_active" type="checkbox" {{if .Source.IsActived}}checked{{end}}>
  157. </div>
  158. </div>
  159. <div class="field">
  160. <button class="ui green button">{{.i18n.Tr "admin.auths.update"}}</button>
  161. <div class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.Source.ID}}">{{.i18n.Tr "admin.auths.delete"}}</div>
  162. </div>
  163. </form>
  164. </div>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. <div class="ui small basic delete modal">
  170. <div class="ui icon header">
  171. <i class="trash icon"></i>
  172. {{.i18n.Tr "admin.auths.delete_auth_title"}}
  173. </div>
  174. <div class="content">
  175. <p>{{.i18n.Tr "admin.auths.delete_auth_desc"}}</p>
  176. </div>
  177. {{template "base/delete_modal_actions" .}}
  178. </div>
  179. {{template "base/footer" .}}