| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- {{template "base" .}}
- {{define "title"}}{{.Title}}{{end}}
- {{define "page_body"}}
- <div class="card shadow mb-4">
- <div class="card-header py-3">
- <h6 class="m-0 font-weight-bold text-primary">Change password</h6>
- </div>
- <div class="card-body">
- {{if .PwdError}}
- <div class="card mb-4 border-left-warning">
- <div class="card-body text-form-error">{{.PwdError}}</div>
- </div>
- {{end}}
- <form id="user_form" action="{{.ChangePwdURL}}" method="POST" autocomplete="off">
- <div class="form-group row">
- <label for="idCurrentPassword" class="col-sm-2 col-form-label">Current password</label>
- <div class="col-sm-10">
- <input type="password" class="form-control" id="idCurrentPassword" name="current_password" required>
- </div>
- </div>
- <div class="form-group row">
- <label for="idNewPassword1" class="col-sm-2 col-form-label">New password</label>
- <div class="col-sm-10">
- <input type="password" class="form-control" id="idNewPassword1" name="new_password1" required>
- </div>
- </div>
- <div class="form-group row">
- <label for="idNewPassword2" class="col-sm-2 col-form-label">Confirm password</label>
- <div class="col-sm-10">
- <input type="password" class="form-control" id="idNewPassword2" name="new_password2" required>
- </div>
- </div>
- <input type="hidden" name="_form_token" value="{{.CSRFToken}}">
- <button type="submit" class="btn btn-primary float-right mt-3 px-5 px-3">Change my password</button>
- </form>
- </div>
- </div>
- {{if .LoggedUser.CanManagePublicKeys}}
- <div class="card shadow mb-4">
- <div class="card-header py-3">
- <h6 class="m-0 font-weight-bold text-primary">Manage public keys</h6>
- </div>
- <div class="card-body">
- {{if .KeyError}}
- <div class="card mb-4 border-left-warning">
- <div class="card-body text-form-error">{{.KeyError}}</div>
- </div>
- {{end}}
- <form id="key_form" action="{{.ManageKeysURL}}" method="POST">
- <div class="form-group row">
- <div class="col-md-12 form_field_pk_outer">
- {{range $idx, $val := .PublicKeys}}
- <div class="row form_field_pk_outer_row">
- <div class="form-group col-md-11">
- <textarea class="form-control" id="idPublicKey{{$idx}}" name="public_keys" rows="4"
- placeholder="Paste your public key here">{{$val}}</textarea>
- </div>
- <div class="form-group col-md-1">
- <button class="btn btn-circle btn-danger remove_pk_btn_frm_field">
- <i class="fas fa-trash"></i>
- </button>
- </div>
- </div>
- {{else}}
- <div class="row form_field_pk_outer_row">
- <div class="form-group col-md-11">
- <textarea class="form-control" id="idPublicKey0" name="public_keys" rows="4"
- placeholder="Paste your public key here"></textarea>
- </div>
- <div class="form-group col-md-1">
- <button class="btn btn-circle btn-danger remove_pk_btn_frm_field" disabled>
- <i class="fas fa-trash"></i>
- </button>
- </div>
- </div>
- {{end}}
- </div>
- </div>
- <div class="row mx-1">
- <button type="button" class="btn btn-secondary add_new_pk_field_btn">
- <i class="fas fa-plus"></i> Add new public key
- </button>
- </div>
- <input type="hidden" name="_form_token" value="{{.CSRFToken}}">
- <button type="submit" class="btn btn-primary float-right mt-3 px-5 px-3">Submit</button>
- </form>
- </div>
- </div>
- {{end}}
- <div class="card shadow mb-4">
- <div class="card-header py-3">
- <h6 class="m-0 font-weight-bold text-primary">REST API access</h6>
- </div>
- <div class="card-body">
- {{if .APIKeyError}}
- <div class="card mb-4 border-left-warning">
- <div class="card-body text-form-error">{{.APIKeyError}}</div>
- </div>
- {{end}}
- <form id="key_form" action="{{.ManageAPIKeyURL}}" method="POST">
- <div class="form-group">
- <div class="form-check">
- <input type="checkbox" class="form-check-input" id="idAllowAPIKeyAuth" name="allow_api_key_auth"
- {{if .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 yourself, in REST API, with an API key. If this permission is not granted, your credentials are required to use the REST API on your behalf
- </small>
- </div>
- </div>
- <input type="hidden" name="_form_token" value="{{.CSRFToken}}">
- <button type="submit" class="btn btn-primary float-right mt-3 px-5 px-3">Submit</button>
- </form>
- </div>
- </div>
- {{end}}
- {{define "extra_js"}}
- <script type="text/javascript">
- $(document).ready(function () {
- $("body").on("click", ".add_new_pk_field_btn", function () {
- var index = $(".form_field_pk_outer").find(".form_field_pk_outer_row").length;
- while (document.getElementById("idPublicKey"+index) != null){
- index++;
- }
- $(".form_field_pk_outer").append(`
- <div class="row form_field_pk_outer_row">
- <div class="form-group col-md-11">
- <textarea class="form-control" id="idPublicKey${index}" name="public_keys" rows="4"
- placeholder="Paste your public key here"></textarea>
- </div>
- <div class="form-group col-md-1">
- <button class="btn btn-circle btn-danger remove_pk_btn_frm_field">
- <i class="fas fa-trash"></i>
- </button>
- </div>
- </div>
- `);
- });
- $("body").on("click", ".remove_pk_btn_frm_field", function () {
- $(this).closest(".form_field_pk_outer_row").remove();
- });
- });
- </script>
- {{end}}
|