0a659428dd
Same swap as sso-manager-node/jump-host: vendored app.util.actionMessage/ actionConfirm replaced by @simpleworkjs/frontend's app.messages.action/ confirm (real HTML-escaping, toast fallback); vendored val.js replaced by the package's app.validate.js. proxy's host/target/hostname validation rules (mirrored from the backend's utils/hostname_validate.js — wildcard DNS patterns, not something other apps need) move to public/js/app.js, registered via $.validateSettings, since they're proxy-specific and don't belong in the shared package's generic rule set (eq/user/password/ip). app.api/app.auth/app.pubsub/app.socket in app-base.js are untouched, same reasoning as sso-manager-node's PR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
151 lines
4.3 KiB
Plaintext
Executable File
151 lines
4.3 KiB
Plaintext
Executable File
<%- include('top') %>
|
|
<script type="text/javascript">
|
|
// Require login to see this page.
|
|
app.auth.forceLogin();
|
|
</script>
|
|
|
|
<style type="text/css">
|
|
@include color-mode(dark) {
|
|
// CSS variable overrides here...
|
|
}
|
|
label.control-label{
|
|
font-weight: bold;
|
|
margin-bottom: 1px;
|
|
}
|
|
.card-title{
|
|
font-weight: bold;
|
|
}
|
|
</style>
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
function populateUsers(actionMessage){
|
|
app.user.list(function(error, data){
|
|
if(error) return app.messages.action(error, $.scope.users.$this, 'danger');
|
|
for(let user of data.results){
|
|
$.scope.users.push(user);
|
|
}
|
|
$.scope.users.__put = function($el, item, list){
|
|
$el.addClass('bg-success');
|
|
$el.fadeIn(3000, function(){
|
|
$el.removeClass('bg-success');
|
|
});
|
|
};
|
|
});
|
|
}
|
|
|
|
function removeUser(username){
|
|
app.user.remove({username: username}, function(error, data){
|
|
if(error) return app.messages.action(error, $.scope.users.$this, 'danger');
|
|
$.scope.users.remove(username);
|
|
});
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
populateUsers(); //populate the table
|
|
|
|
$.scope.users.__take = function($el, item, list){
|
|
$el.addClass('bg-danger');
|
|
$el.fadeOut(1000, function(){
|
|
$el.remove()
|
|
});
|
|
};
|
|
|
|
});
|
|
</script>
|
|
<div class="row" style="display:none">
|
|
<div class="col-md-4">
|
|
<div class="card shadow-lg">
|
|
|
|
<div class="card-header text-center">
|
|
<span class="card-icon float-start">
|
|
<i class="fa-solid fa-user-plus"></i>
|
|
</span>
|
|
<span class="card-title">
|
|
Add New User
|
|
</span>
|
|
<span class="float-end">
|
|
<a href="/docs/access" class="text-reset me-2" title="Help"><i class="fa-solid fa-circle-question"></i></a>
|
|
<i class="fa-solid fa-circle-minus"></i>
|
|
</span>
|
|
</div>
|
|
|
|
<div class="card-header actionMessage" style="display:none"></div>
|
|
<div class="card-body">
|
|
<form action="user/" onsubmit="formAJAX(this)" evalAJAX="
|
|
$.scope.users.splice(0, 0, data);
|
|
">
|
|
<input type="hidden" class="form-control" name="delete" value="false" />
|
|
<div class="form-group">
|
|
<label class="control-label">User-name</label>
|
|
<input type="text" class="form-control" name="username" placeholder="Letter, numbers, -, _, . and @ only" validate="user:3" />
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="control-label">Password</label>
|
|
<input type="password" class="form-control" name="password" placeholder="8+ chars; mix upper/lower/number/symbol (or 12+)" validate="password"/>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="control-label">Again</label>
|
|
<input type="password" class="form-control" name="passwordMatch" placeholder="Retype password" validate="eq:password"/>
|
|
</div>
|
|
<hr />
|
|
<button type="submit" class="btn btn-info">
|
|
Add
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-8">
|
|
<div class="card shadow-lg">
|
|
|
|
<div class="card-header text-center">
|
|
<span class="card-icon float-start">
|
|
<i class="fa-solid fa-users"></i>
|
|
</span>
|
|
<span class="card-title">
|
|
User List
|
|
</span>
|
|
<span class="float-end">
|
|
<a href="/docs/access" class="text-reset me-2" title="Help"><i class="fa-solid fa-circle-question"></i></a>
|
|
<i class="fa-solid fa-circle-minus"></i>
|
|
</span>
|
|
</div>
|
|
|
|
<div class="card-header actionMessage" style="display:none"></div>
|
|
<div class="table-responsive">
|
|
<table class="card-body table table-striped" style="margin-bottom:0">
|
|
<thead>
|
|
<th>Name</th>
|
|
<th>Password</th>
|
|
<th>Delete</th>
|
|
</thead>
|
|
<tbody>
|
|
<tr jq-repeat="users" jq-repeat-index="username" style="display:none" >
|
|
<td class="align-middle">
|
|
{{ username }}
|
|
</td>
|
|
<td>
|
|
|
|
<form class="input-group" action="user/password/{{ username }}" method="put" onsubmit="formAJAX(this)">
|
|
<input type="password" name="password" class="form-control" placeholder="Change {{ username }} password" aria-label="Update password">
|
|
<button class="btn btn-warning" type="submit">Change</button>
|
|
</form>
|
|
|
|
</td>
|
|
<td class="align-middle">
|
|
<button type="button" class="btn btn-danger" onclick="removeUser('{{username}}')">
|
|
<i class="fa-solid fa-user-slash"></i>
|
|
Delete
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<%- include('bottom') %>
|