index.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ovpn-admin</title>
  6. </head>
  7. <body>
  8. <script src="dist/style.min.js"></script>
  9. <div id="app">
  10. <vue-good-table
  11. :columns="columns"
  12. :rows="filteredRows"
  13. :line-numbers="true"
  14. :row-style-class="rowStyleClassFn"
  15. :search-options="{ enabled: true}" >
  16. <div slot="table-actions">
  17. <button type="button" class="btn btn-sm btn-success el-square" v-show="serverRole == 'master'" v-on:click.stop="u.modalNewUserVisible=true">Add user</button>
  18. <b-badget class="btn btn-sm btn-info el-square" v-if="serverRole == 'slave'">Slave - last sync: {{ lastSync }}</b-badget>
  19. <button type="button" class="btn btn-sm btn-secondary el-square" v-on:click.stop="filters.hideRevoked=!filters.hideRevoked;this.$cookies.set('hideRevoked',!(this.$cookies.get('hideRevoked') == 'true'), -1);">{{ revokeFilterText }}</button>
  20. </div>
  21. <div slot="emptystate" class="d-flex justify-content-center">
  22. <h4>No users have been created yet.</h4>
  23. <br>
  24. <button type="button" class="btn btn-sm btn-success el-square" v-if="serverRole == 'master'" v-on:click.stop="u.modalNewUserVisible=true">Add user</button>
  25. </div>
  26. <template slot="table-row" slot-scope="props">
  27. <span v-if="props.column.field == 'actions'">
  28. <button
  29. class="btn btn-sm el-square modal-el-margin"
  30. type="button"
  31. :title="action.label"
  32. :data-username="props.row.Identity"
  33. :data-name="action.name"
  34. :data-text="action.label"
  35. @click.left.stop="rowActionFn"
  36. v-for="action in actions"
  37. v-bind:class="action.class"
  38. v-if="action.showWhenStatus == props.row.AccountStatus && action.showForServerRole.includes(serverRole) && action.showForModule.some(p=> modulesEnabled.includes(p))">
  39. {{ action.label }}
  40. </button>
  41. </span>
  42. </template>
  43. </vue-good-table>
  44. <!-- <div class="d-flex justify-content-md-end">-->
  45. <!-- <button type="button" class="btn btn-sm btn-success el-square new-user-btn" v-on:click.stop="u.ctxVisible=false;u.modalNewUserVisible=true">Add user</button>-->
  46. <!-- </div>-->
  47. <div class="modal-wrapper" v-if="u.modalNewUserVisible" v-bind:style="modalNewUserDisplay">
  48. <div class="modal-dialog modal-lg">
  49. <div class="modal-content">
  50. <div class="modal-header">
  51. <h4>Add new user</h4>
  52. </div>
  53. <div class="modal-body">
  54. <input type="text" class="form-control el-square modal-el-margin" placeholder="Username [_a-zA-Z0-9\.-]" v-model="u.newUserName">
  55. <input type="password" class="form-control el-square modal-el-margin" minlength="6" autocomplete="off" placeholder="Password [_a-zA-Z0-9\.-]" v-model="u.newUserPassword" v-if="modulesEnabled.includes('passwdAuth')">
  56. </div>
  57. <div class="modal-footer justify-content-center" v-if="u.newUserCreateError.length > 0">
  58. <div class="alert alert-danger" role="alert" >
  59. {{ u.newUserCreateError }}
  60. </div>
  61. </div>
  62. <div class="modal-footer">
  63. <button type="button" class="btn btn-success el-square modal-el-margin" v-on:click.stop="createUser()">Create</button>
  64. <button type="button" class="btn btn-primary el-square d-flex justify-content-sm-end modal-el-margin" v-on:click.stop="u.newUserName='';u.newUserPassword='nopass';u.modalNewUserVisible=false">Close</button>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="modal-wrapper" v-if="u.modalChangePasswordVisible" v-bind:style="modalChangePasswordDisplay">
  70. <div class="modal-dialog modal-lg">
  71. <div class="modal-content">
  72. <div class="modal-header">
  73. <h4>Change password for: <strong>{{ username }}</strong></h4>
  74. </div>
  75. <div class="modal-body">
  76. <input type="password" class="form-control el-square modal-el-margin" minlength="6" autocomplete="off" placeholder="Password [_a-zA-Z0-9\.-]" v-model="u.newPassword">
  77. </div>
  78. <div class="modal-footer justify-content-center" v-if="u.passwordChangeMessage.length > 0">
  79. <div class="alert" v-bind:class="passwordChangeStatusCssClass" role="alert" >
  80. {{ u.passwordChangeMessage }}
  81. </div>
  82. </div>
  83. <div class="modal-footer">
  84. <button type="button" class="btn btn-success el-square modal-el-margin" v-on:click.stop="changeUserPassword(username)">Change password</button>
  85. <button type="button" class="btn btn-primary el-square d-flex justify-content-sm-end modal-el-margin" v-on:click.stop="u.newPassword='';u.passwordChangeMessage='';u.modalChangePasswordVisible=false">Close</button>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. <div class="modal-wrapper" v-if="u.modalShowConfigVisible" v-bind:style="modalShowConfigDisplay">
  91. <div class="modal-dialog modal-lg">
  92. <div class="modal-content">
  93. <div class="modal-header">
  94. <h4>ovpn config for: <strong>{{ username }}</strong></h4>
  95. </div>
  96. <div class="modal-body">
  97. <div class="d-flex">
  98. <pre class="modal-show-config-txt-box">{{ u.openvpnConfig }}</pre>
  99. </div>
  100. </div>
  101. <div class="modal-footer">
  102. <div class="d-flex">
  103. <button type="button" class="btn btn-success el-square modal-el-margin" v-clipboard:copy="u.openvpnConfig">Copy </button>
  104. <button type="button" class="btn btn-primary el-square modal-el-margin" v-on:click.stop="u.openvpnConfig='';u.modalShowConfigVisible=false">Cancel</button>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. <div class="modal-wrapper" v-if="u.modalShowCcdVisible" v-bind:style="modalShowCcdDisplay">
  111. <div class="modal-dialog modal-lg modal-dialog-scrollable">
  112. <div class="modal-content">
  113. <div class="modal-header">
  114. <h3 class="static-address-label ">Routes table for: <strong>{{ username }}</strong></h3>
  115. </div>
  116. <div class="modal-body">
  117. <div class="input-group">
  118. <h5 class="static-address-label ">Static address:</h5>
  119. <div class="input-group-prepend">
  120. <div class="input-group-text">
  121. <input id="enable-static" type="checkbox" @change="staticAddrCheckboxOnChange()" v-if="serverRole == 'master'" v-bind:checked="!customAddressDisabled">
  122. </div>
  123. </div>
  124. <input id="static-address" type="text" class="form-control" v-model="u.ccd.ClientAddress" placeholder="127.0.0.1" v-bind:disabled="customAddressDisabled">
  125. </div>
  126. </div>
  127. <div class="modal-body">
  128. <div class="d-flex ">
  129. <table class="table table-bordered table-hover ccd-routes" >
  130. <thead>
  131. <tr>
  132. <th scope="col">Address</th>
  133. <th scope="col">Mask</th>
  134. <th scope="col">Description</th>
  135. <th scope="col" v-if="serverRole == 'master'">Action</th>
  136. </tr>
  137. </thead>
  138. <tbody>
  139. <tr v-for="(customRoute, index) in u.ccd.CustomRoutes">
  140. <td>
  141. <div v-if="serverRole == 'slave'">
  142. {{ customRoute.Address }}
  143. </div>
  144. <input v-if="serverRole == 'master'" v-model="customRoute.Address">
  145. </td>
  146. <td>
  147. <div v-if="serverRole == 'slave'">
  148. {{ customRoute.Mask }}
  149. </div>
  150. <input v-if="serverRole == 'master'" v-model="customRoute.Mask">
  151. </td>
  152. <td>
  153. <div v-if="serverRole == 'slave'">
  154. {{ customRoute.Description }}
  155. </div>
  156. <input v-if="serverRole == 'master'" v-model="customRoute.Description">
  157. </td>
  158. <td class="text-right" v-if="serverRole == 'master'">
  159. <button type="button" class="btn btn-danger btn-sm el-square modal-el-margin" v-if="serverRole == 'master'" v-on:click.stop="u.ccd.CustomRoutes.splice(index, 1)">Delete</button>
  160. </td>
  161. </tr>
  162. <tr v-if="serverRole == 'master'">
  163. <td><input type="text" v-model="u.newRoute.Address"/></td>
  164. <td><input type="text" v-model="u.newRoute.Mask"/></td>
  165. <td><input type="text" v-model="u.newRoute.Description"/></td>
  166. <td class="text-right" v-if="serverRole == 'master'">
  167. <button type="button" class="btn btn-success el-square modal-el-margin" v-on:click.stop="u.ccd.CustomRoutes.push(u.newRoute);u.newRoute={};">Add</button>
  168. </td>
  169. </tr>
  170. </tbody>
  171. </table>
  172. </div>
  173. </div>
  174. <div class="modal-footer justify-content-center" v-if="u.ccdApplyStatusMessage.length > 0">
  175. <div class="alert" v-bind:class="ccdApplyStatusCssClass" role="alert">
  176. {{ u.ccdApplyStatusMessage }}
  177. </div>
  178. </div>
  179. <div class="modal-footer">
  180. <button type="button" class="btn btn-success el-square modal-el-margin" v-if="serverRole == 'master'" v-on:click.stop="ccdApply()">Save</button>
  181. <button type="button" class="btn btn-primary el-square modal-el-margin" v-on:click.stop="u.ccd={Name:'',ClientAddress:'',CustomRoutes:[]};u.ccdApplyStatusMessage='';u.ccdApplyStatus='';u.modalShowCcdVisible=false">Close</button>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. <notifications position="bottom left" :speed="900" />
  187. </div>
  188. <script src="dist/bundle.min.js"></script>
  189. </body>
  190. </html>