2022-07-18 11:43:25 +00:00
|
|
|
<!--
|
|
|
|
Copyright (C) 2019-2022 Nicola Murino
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published
|
|
|
|
by the Free Software Foundation, version 3.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
-->
|
2021-01-17 21:29:08 +00:00
|
|
|
{{template "base" .}}
|
|
|
|
|
|
|
|
{{define "title"}}{{.Title}}{{end}}
|
|
|
|
|
2022-05-22 09:45:49 +00:00
|
|
|
{{define "extra_css"}}
|
|
|
|
<link href="{{.StaticURL}}/vendor/bootstrap-select/css/bootstrap-select.min.css" rel="stylesheet">
|
|
|
|
{{end}}
|
|
|
|
|
2021-01-17 21:29:08 +00:00
|
|
|
{{define "page_body"}}
|
2021-01-22 18:42:18 +00:00
|
|
|
<div class="card shadow mb-4">
|
|
|
|
<div class="card-header py-3">
|
|
|
|
<h6 class="m-0 font-weight-bold text-primary">{{if .IsAdd}}Add a new admin{{else}}Edit admin{{end}}</h6>
|
2021-01-17 21:29:08 +00:00
|
|
|
</div>
|
2021-01-22 18:42:18 +00:00
|
|
|
<div class="card-body">
|
|
|
|
{{if .Error}}
|
|
|
|
<div class="card mb-4 border-left-warning">
|
|
|
|
<div class="card-body text-form-error">{{.Error}}</div>
|
2021-01-17 21:29:08 +00:00
|
|
|
</div>
|
2021-01-22 18:42:18 +00:00
|
|
|
{{end}}
|
|
|
|
<form id="admin_form" action="{{.CurrentURL}}" method="POST" autocomplete="off">
|
|
|
|
<div class="form-group row">
|
|
|
|
<label for="idUsername" class="col-sm-2 col-form-label">Username</label>
|
|
|
|
<div class="col-sm-10">
|
|
|
|
<input type="text" class="form-control" id="idUsername" name="username" placeholder=""
|
|
|
|
value="{{.Admin.Username}}" maxlength="255" autocomplete="nope" required {{if not .IsAdd}}readonly{{end}}>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-01-17 21:29:08 +00:00
|
|
|
|
2021-09-29 16:46:15 +00:00
|
|
|
<div class="form-group row">
|
|
|
|
<label for="idEmail" class="col-sm-2 col-form-label">Email</label>
|
|
|
|
<div class="col-sm-10">
|
|
|
|
<input type="text" class="form-control" id="idEmail" name="email" placeholder=""
|
|
|
|
value="{{.Admin.Email}}" maxlength="255">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-02-24 18:40:29 +00:00
|
|
|
<div class="form-group row">
|
|
|
|
<label for="idDescription" class="col-sm-2 col-form-label">Description</label>
|
|
|
|
<div class="col-sm-10">
|
|
|
|
<input type="text" class="form-control" id="idDescription" name="description" placeholder=""
|
|
|
|
value="{{.Admin.Description}}" maxlength="255" aria-describedby="descriptionHelpBlock">
|
|
|
|
<small id="descriptionHelpBlock" class="form-text text-muted">
|
|
|
|
Optional description, for example the admin full name
|
|
|
|
</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-01-22 18:42:18 +00:00
|
|
|
<div class="form-group row">
|
|
|
|
<label for="idStatus" class="col-sm-2 col-form-label">Status</label>
|
|
|
|
<div class="col-sm-10">
|
2022-05-22 09:45:49 +00:00
|
|
|
<select class="form-control selectpicker" id="idStatus" name="status">
|
2021-01-22 18:42:18 +00:00
|
|
|
<option value="1" {{if eq .Admin.Status 1 }}selected{{end}}>Active</option>
|
|
|
|
<option value="0" {{if eq .Admin.Status 0 }}selected{{end}}>Inactive</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-01-17 21:29:08 +00:00
|
|
|
|
2021-01-22 18:42:18 +00:00
|
|
|
<div class="form-group row">
|
|
|
|
<label for="idPassword" class="col-sm-2 col-form-label">Password</label>
|
|
|
|
<div class="col-sm-10">
|
|
|
|
<input type="password" class="form-control" id="idPassword" name="password" placeholder=""
|
|
|
|
{{if not .IsAdd}}aria-describedby="pwdHelpBlock" {{end}}>
|
|
|
|
{{if not .IsAdd}}
|
|
|
|
<small id="pwdHelpBlock" class="form-text text-muted">
|
|
|
|
If empty the current password will not be changed
|
|
|
|
</small>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-01-17 21:29:08 +00:00
|
|
|
|
2021-01-22 18:42:18 +00:00
|
|
|
<div class="form-group row">
|
|
|
|
<label for="idPermissions" class="col-sm-2 col-form-label">Permissions</label>
|
|
|
|
<div class="col-sm-10">
|
2022-05-22 09:45:49 +00:00
|
|
|
<select class="form-control selectpicker" id="idPermissions" name="permissions" required multiple>
|
2021-01-22 18:42:18 +00:00
|
|
|
{{range $validPerm := .Admin.GetValidPerms}}
|
|
|
|
<option value="{{$validPerm}}" {{range $perm :=$.Admin.Permissions }}
|
|
|
|
{{if eq $perm $validPerm}}selected{{end}}{{end}}>{{$validPerm}}
|
|
|
|
</option>
|
|
|
|
{{end}}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-01-17 21:29:08 +00:00
|
|
|
|
2021-01-22 18:42:18 +00:00
|
|
|
<div class="form-group row">
|
|
|
|
<label for="idAllowedIP" class="col-sm-2 col-form-label">Allowed IP/Mask</label>
|
|
|
|
<div class="col-sm-10">
|
2021-11-25 19:09:11 +00:00
|
|
|
<textarea class="form-control" id="idAllowedIP" name="allowed_ip" rows="3" placeholder=""
|
|
|
|
aria-describedby="allowedIPHelpBlock">{{.Admin.GetAllowedIPAsString}}</textarea>
|
2021-01-22 18:42:18 +00:00
|
|
|
<small id="allowedIPHelpBlock" class="form-text text-muted">
|
|
|
|
Comma separated IP/Mask in CIDR format, for example "192.168.1.0/24,10.8.0.100/32"
|
|
|
|
</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-01-17 21:29:08 +00:00
|
|
|
|
2021-08-17 16:08:32 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<div class="form-check">
|
|
|
|
<input type="checkbox" class="form-check-input" id="idAllowAPIKeyAuth" name="allow_api_key_auth"
|
|
|
|
{{if .Admin.Filters.AllowAPIKeyAuth}}checked{{end}} aria-describedby="allowAPIKeyAuthHelpBlock">
|
|
|
|
<label for="idAllowAPIKeyAuth" class="form-check-label">Allow API key authentication</label>
|
|
|
|
<small id="allowAPIKeyAuthHelpBlock" class="form-text text-muted">
|
|
|
|
Allow to impersonate this admin, in REST API, with an API key
|
|
|
|
</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-01-22 18:42:18 +00:00
|
|
|
<div class="form-group row">
|
|
|
|
<label for="idAdditionalInfo" class="col-sm-2 col-form-label">Additional info</label>
|
|
|
|
<div class="col-sm-10">
|
|
|
|
<textarea class="form-control" id="idAdditionalInfo" name="additional_info" rows="3"
|
|
|
|
aria-describedby="additionalInfoHelpBlock">{{.Admin.AdditionalInfo}}</textarea>
|
|
|
|
<small id="additionalInfoHelpBlock" class="form-text text-muted">
|
|
|
|
Free form text field
|
|
|
|
</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-01-17 21:29:08 +00:00
|
|
|
|
2021-02-03 07:55:28 +00:00
|
|
|
<input type="hidden" name="_form_token" value="{{.CSRFToken}}">
|
2022-01-12 18:01:19 +00:00
|
|
|
<button type="submit" class="btn btn-primary float-right mt-3 px-5">Submit</button>
|
2021-01-22 18:42:18 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-05-22 09:45:49 +00:00
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{define "extra_js"}}
|
|
|
|
<script src="{{.StaticURL}}/vendor/bootstrap-select/js/bootstrap-select.min.js"></script>
|
2021-01-17 21:29:08 +00:00
|
|
|
{{end}}
|