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.

178 lines
8.2 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. {{template "base/head" .}}
  2. {{template "base/navbar" .}}
  3. <div id="body" class="container" data-page="admin">
  4. {{template "admin/nav" .}}
  5. <div id="admin-container" class="col-md-9">
  6. <div class="panel panel-default">
  7. <div class="panel-heading">
  8. New Authentication
  9. </div>
  10. <div class="panel-body">
  11. <br/>
  12. <form action="/admin/auths/new" method="post" class="form-horizontal">
  13. {{.CsrfTokenHtml}}
  14. {{template "base/alert" .}}
  15. <div class="form-group">
  16. <label class="col-md-3 control-label">Auth Type: </label>
  17. <div class="col-md-7">
  18. <select name="type" class="form-control" id="auth-type">
  19. {{range $key, $val := .LoginTypes}}
  20. <option value="{{$key}}">{{$val}}</option>
  21. {{end}}
  22. </select>
  23. </div>
  24. </div>
  25. <div class="form-group {{if .Err_AuthName}}has-error has-feedback{{end}}">
  26. <label class="col-md-3 control-label">Name: </label>
  27. <div class="col-md-7">
  28. <input name="name" class="form-control" placeholder="Type authentication's name" value="{{.name}}">
  29. </div>
  30. </div>
  31. <div class="ldap">
  32. <div class="form-group {{if .Err_Domain}}has-error has-feedback{{end}}">
  33. <label class="col-md-3 control-label">Domain: </label>
  34. <div class="col-md-7">
  35. <input name="domain" class="form-control" placeholder="Type domain name" value="{{.domain}}">
  36. </div>
  37. </div>
  38. <div class="form-group {{if .Err_Host}}has-error has-feedback{{end}}">
  39. <label class="col-md-3 control-label">Host: </label>
  40. <div class="col-md-7">
  41. <input name="host" class="form-control" placeholder="Type host address" value="{{.host}}">
  42. </div>
  43. </div>
  44. <div class="form-group {{if .Err_Port}}has-error has-feedback{{end}}">
  45. <label class="col-md-3 control-label">Port: </label>
  46. <div class="col-md-7">
  47. <input name="port" class="form-control" placeholder="Type port number" value="{{.port}}">
  48. </div>
  49. </div>
  50. <div class="form-group {{if .Err_UseSSL}}has-error has-feedback{{end}}">
  51. <label class="col-md-3 control-label">Use SSL: </label>
  52. <div class="col-md-7">
  53. <input name="usessl" class="form-control" type="checkbox" {{if .usessl}}checked{{end}}>
  54. </div>
  55. </div>
  56. <div class="form-group {{if .Err_BaseDN}}has-error has-feedback{{end}}">
  57. <label class="col-md-3 control-label">Base DN: </label>
  58. <div class="col-md-7">
  59. <input name="base_dn" class="form-control" placeholder="Type base DN" value="{{.base_dn}}">
  60. </div>
  61. </div>
  62. <div class="form-group {{if .Err_Attributes}}has-error has-feedback{{end}}">
  63. <label class="col-md-3 control-label">Search Attributes: </label>
  64. <div class="col-md-7">
  65. <input name="attributes" class="form-control" placeholder="Type search attributes" value="{{.attributes}}">
  66. </div>
  67. </div>
  68. <div class="form-group {{if .Err_Filter}}has-error has-feedback{{end}}">
  69. <label class="col-md-3 control-label">Search Filter: </label>
  70. <div class="col-md-7">
  71. <input name="filter" class="form-control" placeholder="Type search filter" value="{{.filter}}">
  72. </div>
  73. </div>
  74. <div class="form-group {{if .Err_MsAdSA}}has-error has-feedback{{end}}">
  75. <label class="col-md-3 control-label">Ms Ad SA: </label>
  76. <div class="col-md-7">
  77. <input name="ms_ad_sa" class="form-control" placeholder="Type Ms Ad SA" value="{{.ms_ad_sa}}">
  78. </div>
  79. </div>
  80. </div>
  81. <div class="smtp hidden">
  82. <div class="form-group">
  83. <label class="col-md-3 control-label">SMTP Auth: </label>
  84. <div class="col-md-7">
  85. <select name="smtpauth" class="form-control">
  86. {{range .SMTPAuths}}
  87. <option value="{{.}}">{{.}}</option>
  88. {{end}}
  89. </select>
  90. </div>
  91. </div>
  92. <div class="form-group {{if .Err_SmtpHost}}has-error has-feedback{{end}}">
  93. <label class="col-md-3 control-label">Host: </label>
  94. <div class="col-md-7">
  95. <input name="smtphost" class="form-control" placeholder="Type host address" value="{{.smtphost}}">
  96. </div>
  97. </div>
  98. <div class="form-group {{if .Err_SmtpPort}}has-error has-feedback{{end}}">
  99. <label class="col-md-3 control-label">Port: </label>
  100. <div class="col-md-7">
  101. <input name="smtpport" class="form-control" placeholder="Type port number" value="{{.smtpport}}">
  102. </div>
  103. </div>
  104. <div class="form-group">
  105. <div class="col-md-offset-3 col-md-7">
  106. <div class="checkbox">
  107. <label>
  108. <input name="tls" type="checkbox" {{if .tls}}checked{{end}}>
  109. <strong>Enable TLS Encryption</strong>
  110. </label>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. <div class="form-group">
  116. <div class="col-md-offset-3 col-md-7">
  117. <div class="checkbox">
  118. <label>
  119. <input name="allowautoregister" type="checkbox" {{if .allowautoregister}}checked{{end}}>
  120. <strong>Enable Auto Registration</strong>
  121. </label>
  122. </div>
  123. </div>
  124. </div>
  125. <hr/>
  126. <div class="form-group">
  127. <div class="col-md-offset-3 col-md-7">
  128. <button type="submit" class="btn btn-lg btn-primary">Create new authentication</button>
  129. </div>
  130. </div>
  131. </form>
  132. </div>
  133. </div>
  134. <div class="panel panel-info">
  135. <div class="panel-heading">
  136. Tips
  137. </div>
  138. <div class="panel-body">
  139. <h5>GMail Setting:</h5>
  140. <p>Host: smtp.gmail.com, Post: 587, Enable TLS Encryption: true</p>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <script>
  146. $(function () {
  147. $('#auth-type').on("change", function () {
  148. var v = $(this).val();
  149. if (v == 2) {
  150. $('.ldap').toggleShow();
  151. $('.smtp').toggleHide();
  152. }
  153. if (v == 3) {
  154. $('.smtp').toggleShow();
  155. $('.ldap').toggleHide();
  156. }
  157. });
  158. });
  159. </script>
  160. {{template "base/footer" .}}