1
0
Fork 0
mirror of synced 2024-11-23 17:25:36 -05:00
ovpn-admin/frontend/static/index.html

237 lines
12 KiB
HTML
Raw Permalink Normal View History

2020-05-14 19:13:33 -04:00
<!DOCTYPE html>
<html lang="en">
2020-10-29 06:50:19 -04:00
<head>
<meta charset="utf-8">
2021-03-17 05:05:37 -04:00
<title>ovpn-admin</title>
2020-10-29 06:50:19 -04:00
</head>
<body>
<script src="dist/style.min.js"></script>
2020-10-29 06:50:19 -04:00
<div id="app">
<vue-good-table
:columns="columns"
:rows="filteredRows"
2020-10-29 06:50:19 -04:00
:line-numbers="true"
:row-style-class="rowStyleClassFn"
:search-options="{ enabled: true}" >
<div slot="table-actions">
2020-11-20 11:11:58 -05:00
<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>
<b-badget class="btn btn-sm btn-info el-square" v-if="serverRole == 'slave'">Slave - last sync: {{ lastSync }}</b-badget>
<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>
2020-10-29 06:50:19 -04:00
</div>
<div slot="emptystate" class="d-flex justify-content-center">
<h4>No users have been created yet.</h4>
<br>
<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>
2020-10-29 06:50:19 -04:00
</div>
<template slot="table-row" slot-scope="props">
<span v-if="props.column.field == 'actions'">
<button
class="btn btn-sm el-square modal-el-margin"
2020-10-29 06:50:19 -04:00
type="button"
:title="action.label"
:data-username="props.row.Identity"
:data-name="action.name"
:data-text="action.label"
@click.left.stop="rowActionFn"
v-for="action in actions"
v-bind:class="action.class"
v-if="action.showWhenStatus == props.row.AccountStatus && action.showForServerRole.includes(serverRole) && action.showForModule.some(p=> modulesEnabled.includes(p))">
2020-10-29 06:50:19 -04:00
{{ action.label }}
</button>
</span>
</template>
</vue-good-table>
<div class="modal-wrapper" v-if="u.modalNewUserVisible" v-bind:style="modalNewUserDisplay">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4>Add new user</h4>
2020-10-29 06:50:19 -04:00
</div>
<div class="modal-body">
<input type="text" class="form-control el-square modal-el-margin" placeholder="Username [_a-zA-Z0-9\.-]" v-model="u.newUserName">
2021-03-15 04:35:12 -04:00
<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')">
2020-10-29 06:50:19 -04:00
</div>
2020-05-14 19:13:33 -04:00
2020-10-29 06:50:19 -04:00
<div class="modal-footer justify-content-center" v-if="u.newUserCreateError.length > 0">
<div class="alert alert-danger" role="alert" >
{{ u.newUserCreateError }}
2020-05-14 19:13:33 -04:00
</div>
2020-10-29 06:50:19 -04:00
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success el-square modal-el-margin" v-on:click.stop="createUser()">Create</button>
2020-10-29 06:50:19 -04:00
<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>
</div>
2020-05-14 19:13:33 -04:00
</div>
2020-10-29 06:50:19 -04:00
</div>
</div>
2020-05-14 19:13:33 -04:00
<div class="modal-wrapper" v-if="u.modalChangePasswordVisible" v-bind:style="modalChangePasswordDisplay">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4>Change password for: <strong>{{ username }}</strong></h4>
</div>
<div class="modal-body">
<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">
</div>
<div class="modal-footer justify-content-center" v-if="u.passwordChangeMessage.length > 0">
<div class="alert" v-bind:class="passwordChangeStatusCssClass" role="alert" >
{{ u.passwordChangeMessage }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success el-square modal-el-margin" v-on:click.stop="changeUserPassword(username)">Change password</button>
<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>
</div>
</div>
</div>
</div>
2020-10-29 06:50:19 -04:00
<div class="modal-wrapper" v-if="u.modalShowConfigVisible" v-bind:style="modalShowConfigDisplay">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4>ovpn config for: <strong>{{ username }}</strong></h4>
2020-10-29 06:50:19 -04:00
</div>
<div class="modal-body">
<div class="d-flex">
<pre class="modal-show-config-txt-box">{{ u.openvpnConfig }}</pre>
</div>
</div>
<div class="modal-footer">
<div class="d-flex">
<button type="button" class="btn btn-success el-square modal-el-margin" v-clipboard:copy="u.openvpnConfig">Copy </button>
<button type="button" class="btn btn-primary el-square modal-el-margin" v-on:click.stop="u.openvpnConfig='';u.modalShowConfigVisible=false">Cancel</button>
2020-05-14 19:13:33 -04:00
</div>
2020-10-29 06:50:19 -04:00
</div>
2020-05-14 19:13:33 -04:00
</div>
2020-10-29 06:50:19 -04:00
</div>
</div>
2020-05-14 19:13:33 -04:00
2020-10-29 06:50:19 -04:00
<div class="modal-wrapper" v-if="u.modalShowCcdVisible" v-bind:style="modalShowCcdDisplay">
<div class="modal-dialog modal-lg modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h3 class="static-address-label ">Routes table for: <strong>{{ username }}</strong></h3>
</div>
<div class="modal-body">
2020-10-29 06:50:19 -04:00
<div class="input-group">
<h5 class="static-address-label ">Static address:</h5>
<input id="static-address" type="text" class="form-control" v-model="u.ccd.ClientAddress" placeholder="127.0.0.1">
<div class="input-group-append">
<button id="static-address-clear" class="btn btn-warning" type="button" v-on:click="u.ccd.ClientAddress = 'dynamic'" v-if="serverRole == 'master'" v-bind:disabled="customAddressDynamic">Clear</button>
2020-10-15 12:12:31 -04:00
</div>
</div>
2020-10-29 06:50:19 -04:00
</div>
<div class="modal-body">
<div class="d-flex ">
<table class="table table-bordered table-hover ccd-routes" >
2020-10-29 06:50:19 -04:00
<thead>
<tr>
<th scope="col">Address</th>
<th scope="col">Mask</th>
<th scope="col">Description</th>
2020-11-20 11:11:58 -05:00
<th scope="col" v-if="serverRole == 'master'">Action</th>
2020-10-29 06:50:19 -04:00
</tr>
</thead>
<tbody>
<tr v-for="(customRoute, index) in u.ccd.CustomRoutes">
<td>
<div v-if="serverRole == 'slave'">
2020-11-20 11:11:58 -05:00
{{ customRoute.Address }}
</div>
<input v-if="serverRole == 'master'" v-model="customRoute.Address">
2020-11-20 11:11:58 -05:00
</td>
<td>
<div v-if="serverRole == 'slave'">
2020-11-20 11:11:58 -05:00
{{ customRoute.Mask }}
</div>
<input v-if="serverRole == 'master'" v-model="customRoute.Mask">
2020-11-20 11:11:58 -05:00
</td>
<td>
<div v-if="serverRole == 'slave'">
2020-11-20 11:11:58 -05:00
{{ customRoute.Description }}
</div>
<input v-if="serverRole == 'master'" v-model="customRoute.Description">
2020-11-20 11:11:58 -05:00
</td>
<td class="text-right" v-if="serverRole == 'master'">
<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>
2020-10-29 06:50:19 -04:00
</td>
</tr>
<tr v-if="serverRole == 'master'">
2020-10-29 06:50:19 -04:00
<td><input type="text" v-model="u.newRoute.Address"/></td>
<td><input type="text" v-model="u.newRoute.Mask"/></td>
<td><input type="text" v-model="u.newRoute.Description"/></td>
2020-11-20 11:11:58 -05:00
<td class="text-right" v-if="serverRole == 'master'">
2020-10-29 06:50:19 -04:00
<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>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="modal-footer justify-content-center" v-if="u.ccdApplyStatusMessage.length > 0">
<div class="alert" v-bind:class="ccdApplyStatusCssClass" role="alert">
{{ u.ccdApplyStatusMessage }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success el-square modal-el-margin" v-if="serverRole == 'master'" v-on:click.stop="ccdApply()">Save</button>
2020-10-29 06:50:19 -04:00
<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>
</div>
</div>
2020-05-14 19:13:33 -04:00
</div>
2020-10-29 06:50:19 -04:00
</div>
<div class="modal-wrapper" v-if="u.modalRotateUserVisible" v-bind:style="modalRotateUserDisplay">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4>Confirm rotating certificates for user: <strong>{{ username }}</strong></h4>
</div>
<div class="modal-body" v-if="modulesEnabled.includes('passwdAuth')">
<h4>Enter new password:</h4>
<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">
</div>
<div class="modal-footer justify-content-center" v-if="u.rotateUserMessage.length > 0">
<div class="alert" v-bind:class="userRotateStatusCssClass" role="alert" >
{{ u.rotateUserMessage }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger el-square modal-el-margin" v-on:click.stop="rotateUser(username)">Rotate</button>
<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.rotateUserMessage='';u.modalRotateUserVisible=false">Close</button>
</div>
</div>
</div>
</div>
<div class="modal-wrapper" v-if="u.modalDeleteUserVisible" v-bind:style="modalDeleteUserDisplay">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4>Confirm deleting user: <strong>{{ username }}</strong></h4>
</div>
<div class="modal-footer justify-content-center" v-if="u.deleteUserMessage.length > 0">
<div class="alert" v-bind:class="deleteUserStatusCssClass" role="alert" >
{{ u.deleteUserMessage }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger el-square modal-el-margin" v-on:click.stop="deleteUser(username)">Delete</button>
<button type="button" class="btn btn-primary el-square d-flex justify-content-sm-end modal-el-margin" v-on:click.stop="u.deleteUserMessage='';u.modalDeleteUserVisible=false">Close</button>
</div>
</div>
</div>
</div>
<notifications position="bottom left" :speed="900" />
2020-10-29 06:50:19 -04:00
</div>
<script src="dist/bundle.min.js"></script>
2020-10-29 06:50:19 -04:00
</body>
2020-05-14 19:13:33 -04:00
</html>