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

293 lines
14 KiB
HTML
Raw 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"
2022-12-30 09:25:21 -05:00
:data-secondfactor="props.row.SecondFactor"
2020-10-29 06:50:19 -04:00
:data-name="action.name"
:data-text="action.label"
@click.left.stop="rowActionFn"
v-for="action in actions"
v-bind:class="action.class"
2023-10-06 14:47:28 -04:00
v-if="action.showWhenStatus == props.row.AccountStatus &&
( props.row.SecondFactor != 'disabled' || !(action.Require2FA) ) &&
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>
2022-12-30 09:25:21 -05:00
<div class="modal-wrapper" v-if="u.modalNewUserVisible" v-bind:style="[u.modalNewUserVisible ? {display: 'flex'} : {}]">
2020-10-29 06:50:19 -04:00
<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">
2023-10-06 14:47:28 -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')||modulesEnabled.includes('totpAuth')">
2020-10-29 06:50:19 -04:00
</div>
2020-05-14 19:13:33 -04:00
2022-12-30 09:25:21 -05:00
<div class="modal-footer justify-content-center" v-if="u.modalActionMessage.length > 0">
<div class="alert" v-bind:class="alertCssClass" role="alert" > >
{{ u.modalActionMessage }}
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>
2022-12-30 09:25:21 -05: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.modalActionMessage='';u.modalNewUserVisible=false">Close</button>
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
2022-12-30 09:25:21 -05:00
<div class="modal-wrapper" v-if="u.modalChangePasswordVisible" v-bind:style="[u.modalChangePasswordVisible ? {display: 'flex'} : {}]">
<div class="modal-dialog modal-lg">
<div class="modal-content">
2022-12-30 09:25:21 -05:00
<div class="modal-header">
<h4>Change password for: <strong>{{ username }}</strong></h4>
</div>
2022-12-30 09:25:21 -05:00
<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>
2022-12-30 09:25:21 -05:00
<div class="modal-footer justify-content-center" v-if="u.modalActionMessage.length > 0">
<div class="alert" v-bind:class="alertCssClass" role="alert" >
{{ u.modalActionMessage }}
</div>
</div>
2022-12-30 09:25:21 -05:00
<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>
2022-12-30 09:25:21 -05:00
<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.modalActionMessage='';u.modalChangePasswordVisible=false">Close</button>
</div>
2022-12-30 09:25:21 -05:00
</div>
</div>
</div>
2020-05-14 19:13:33 -04:00
2022-12-30 09:25:21 -05:00
<div class="modal-wrapper" v-if="u.modalShowCcdVisible" v-bind:style="[u.modalShowCcdVisible ? {display: 'flex'} : {}]">
2020-10-29 06:50:19 -04:00
<div class="modal-dialog modal-lg modal-dialog-scrollable">
<div class="modal-content">
2022-12-30 09:25:21 -05:00
2020-10-29 06:50:19 -04:00
<div class="modal-header">
<h3 class="static-address-label ">Routes table for: <strong>{{ username }}</strong></h3>
</div>
2022-12-30 09:25:21 -05:00
<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>
2022-12-30 09:25:21 -05:00
2020-10-29 06:50:19 -04:00
<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>
2022-12-30 09:25:21 -05:00
<div class="modal-footer justify-content-center" v-if="u.modalActionMessage.length > 0">
<div class="alert" v-bind:class="alertCssClass" role="alert">
{{ u.modalActionMessage }}
2020-10-29 06:50:19 -04:00
</div>
</div>
2022-12-30 09:25:21 -05:00
2020-10-29 06:50:19 -04:00
<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>
2022-12-30 09:25:21 -05:00
<button type="button" class="btn btn-primary el-square modal-el-margin" v-on:click.stop="u.ccd={Name:'',ClientAddress:'',CustomRoutes:[]};u.modalActionMessage='';u.ccdApplyStatus='';u.modalShowCcdVisible=false">Close</button>
2020-10-29 06:50:19 -04:00
</div>
</div>
2022-12-30 09:25:21 -05:00
2020-05-14 19:13:33 -04:00
</div>
2020-10-29 06:50:19 -04:00
</div>
2022-12-30 09:25:21 -05:00
<div class="modal-wrapper" v-if="u.modalRotateUserVisible" v-bind:style="[u.modalRotateUserVisible ? {display: 'flex'} : {}]">
<div class="modal-dialog">
<div class="modal-content">
2022-12-30 09:25:21 -05:00
<div class="modal-header">
<h4>Confirm rotating certificates for user: <strong>{{ username }}</strong></h4>
</div>
2022-12-30 09:25:21 -05:00
<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>
2022-12-30 09:25:21 -05:00
<div class="modal-footer justify-content-center" v-if="u.modalActionMessage.length > 0">
<div class="alert" v-bind:class="alertCssClass" role="alert" >
{{ u.modalActionMessage }}
</div>
</div>
2022-12-30 09:25:21 -05:00
<div class="modal-footer">
<button type="button" class="btn btn-danger el-square modal-el-margin" v-on:click.stop="rotateUser(username)">Rotate</button>
2022-12-30 09:25:21 -05:00
<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.modalActionMessage='';u.modalRotateUserVisible=false">Close</button>
</div>
2022-12-30 09:25:21 -05:00
</div>
</div>
</div>
2022-12-30 09:25:21 -05:00
<div class="modal-wrapper" v-if="u.modalDeleteUserVisible" v-bind:style="[u.modalDeleteUserVisible ? {display: 'flex'} : {}]">
<div class="modal-dialog">
<div class="modal-content">
2022-12-30 09:25:21 -05:00
<div class="modal-header">
<h4>Confirm deleting user: <strong>{{ username }}</strong></h4>
</div>
2022-12-30 09:25:21 -05:00
<div class="modal-footer justify-content-center" v-if="u.modalActionMessage.length > 0">
<div class="alert" v-bind:class="alertCssClass" role="alert" >
{{ u.modalActionMessage }}
</div>
</div>
2022-12-30 09:25:21 -05:00
<div class="modal-footer">
<button type="button" class="btn btn-danger el-square modal-el-margin" v-on:click.stop="deleteUser(username)">Delete</button>
2022-12-30 09:25:21 -05:00
<button type="button" class="btn btn-primary el-square d-flex justify-content-sm-end modal-el-margin" v-on:click.stop="u.modalActionMessage='';u.modalDeleteUserVisible=false">Close</button>
</div>
</div>
</div>
</div>
<div class="modal-wrapper" v-if="u.modalRegister2faVisible" v-bind:style="[u.modalRegister2faVisible ? {display: 'flex'} : {}]">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header justify-content-center">
2023-10-06 14:47:28 -04:00
<h4>2FA TOTP</h4>
2022-12-30 09:25:21 -05:00
</div>
2023-10-06 14:47:28 -04:00
<div class="modal-body justify-content-center" v-if="secondfactor == 'disabled' ">
2022-12-30 09:25:21 -05:00
<div style="text-align: center">
<vue-qr
:text=u.twofaurl
:size="300"
></vue-qr>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Can't scan the code? </h5>
<h6 class="card-subtitle text-muted">To add the entry manually, provide the following details to the application on your phone.</h6>
<div class="justify-content-left" style="margin-top: 1em;">
<p style="margin: 0;">
Account: OVPN:{{username}}
</p>
<p style="margin: 0;">
Key: <code class="two-factor-secret">{{u.secret}}</code>
</p>
<p style="margin: 0;">
Time based: Yes
</p>
</div>
</div>
</div>
<input type="text" class="form-control el-square modal-el-margin" minlength="6" autocomplete="off" placeholder="Pin Code" v-model="u.token">
</div>
2022-12-30 09:25:21 -05:00
2023-10-06 14:47:28 -04:00
<div class="modal-body justify-content-center" v-if="secondfactor == 'enabled' ">
<h4>2FA with TOTP already configured for user: <strong>{{ username }}</strong></h4>
2022-12-30 09:25:21 -05:00
</div>
<div class="modal-footer justify-content-center" v-if="u.modalActionMessage.length > 0">
<div class="alert" v-bind:class="alertCssClass" role="alert" >
{{ u.modalActionMessage }}
</div>
</div>
<div class="modal-footer">
2023-10-06 14:47:28 -04:00
<button type="button" class="btn btn-success el-square modal-el-margin" v-if="secondfactor == 'disabled' " v-on:click.stop="registerUser2faApp(username)">Register 2FA TOTP</button>
<button type="button" class="btn btn-danger el-square modal-el-margin" v-if="secondfactor == 'enabled' " v-on:click.stop="resetUser2faApp(username)">Reset 2FA TOTP</button>
2022-12-30 09:25:21 -05:00
<button type="button" class="btn btn-primary el-square d-flex justify-content-sm-end modal-el-margin" v-on:click.stop="u.modalActionMessage='';u.modalRegister2faVisible=false;u.token=''">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>