mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-24 04:57:00 +01:00
Implement credential update page in HTMX --------- Co-authored-by: James Hodgkinson <james@terminaloutcomes.com> Co-authored-by: Firstyear <william@blackhats.net.au>
106 lines
5.3 KiB
HTML
106 lines
5.3 KiB
HTML
<div class="row g-3" id="credentialUpdateDynamicSection" hx-on::before-swap="stillSwapFailureResponse(event)">
|
|
<form class="needs-validation" novalidate>
|
|
(% match ext_cred_portal %)
|
|
(% when CUExtPortal::None %)
|
|
(% when CUExtPortal::Hidden %)
|
|
<hr class="my-4" />
|
|
<p>This account is externally managed. Some features may not be available.</p>
|
|
(% when CUExtPortal::Some(url) %)
|
|
<hr class="my-4" />
|
|
<p>This account is externally managed. Some features may not be available.</p>
|
|
<a href="(( url ))">Visit the external account portal</a>
|
|
(% endmatch %)
|
|
|
|
(% if warnings.len() > 0 %)
|
|
<hr class="my-4" >
|
|
(% for warning in warnings %)
|
|
(% let is_danger = [CURegWarning::WebauthnAttestationUnsatisfiable, CURegWarning::Unsatisfiable].contains(warning) %)
|
|
|
|
<div class='alert alert-(( is_danger|ternary("danger", "warning") ))' role="alert">
|
|
(% match warning %)
|
|
(% when CURegWarning::MfaRequired %)
|
|
Multi-Factor Authentication is required for your account. Either add TOTP or remove your password in favour of passkeys to submit.
|
|
(% when CURegWarning::PasskeyRequired %)
|
|
Passkeys are required for your account.
|
|
(% when CURegWarning::AttestedPasskeyRequired %)
|
|
Attested Passkeys are required for your account.
|
|
(% when CURegWarning::AttestedResidentKeyRequired %)
|
|
Attested Resident Keys are required for your account.
|
|
(% when CURegWarning::WebauthnAttestationUnsatisfiable %)
|
|
A webauthn attestation policy conflict has occurred and you will not be able to save your credentials
|
|
(% when CURegWarning::Unsatisfiable %)
|
|
An account policy conflict has occurred and you will not be able to save your credentials
|
|
(% endmatch %)
|
|
|
|
(% if is_danger %)
|
|
<br><br>
|
|
<b>Contact support IMMEDIATELY.</b>
|
|
(% endif %)
|
|
</div>
|
|
(% endfor %)
|
|
(% endif %)
|
|
|
|
<!-- Attested Passkeys -->
|
|
(% match attested_passkeys_state %)
|
|
(% when CUCredState::Modifiable %)
|
|
(% include "credentials_update_attested_passkeys.html" %)
|
|
<button type="button" class="btn btn-primary" hx-post="/ui/reset/add_passkey" hx-vals='{"class": "Attested"}' hx-target="#credentialUpdateDynamicSection">
|
|
Add Attested Passkey
|
|
</button>
|
|
(% when CUCredState::DeleteOnly %)
|
|
(% if attested_passkeys.len() > 0 %)
|
|
(% include "credentials_update_attested_passkeys.html" %)
|
|
(% endif %)
|
|
(% when CUCredState::AccessDeny %)
|
|
(% when CUCredState::PolicyDeny %)
|
|
(% endmatch %)
|
|
|
|
<!-- Passkeys -->
|
|
(% match passkeys_state %)
|
|
(% when CUCredState::Modifiable %)
|
|
(% include "credentials_update_passkeys.html" %)
|
|
<!-- Here we are modifiable so we can render the button to add passkeys -->
|
|
<div class="btn-group">
|
|
<button type="button" class="btn btn-primary" hx-post="/ui/reset/add_passkey"
|
|
hx-vals='{"class": "Any"}'
|
|
hx-target="#credentialUpdateDynamicSection">
|
|
Add Passkey
|
|
</button>
|
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<span class="visually-hidden">Toggle Dropdown</span>
|
|
</button>
|
|
<ul class="dropdown-menu">
|
|
<li><a class="dropdown-item" hx-post="/ui/api/cancel_mfareg" hx-swap="none">Cancel MFA Registration session</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
(% when CUCredState::DeleteOnly %)
|
|
(% if passkeys.len() > 0 %)
|
|
(% include "credentials_update_passkeys.html" %)
|
|
(% endif %)
|
|
(% when CUCredState::AccessDeny %)
|
|
(% when CUCredState::PolicyDeny %)
|
|
(% endmatch %)
|
|
|
|
<!-- Password, totp credentials -->
|
|
(% let primary_state = primary_state %)
|
|
(% include "credentials_update_primary.html" %)
|
|
|
|
<hr class="my-4"/>
|
|
|
|
<div class="d-flex flex-row flex-wrap justify-content-between">
|
|
<button class="btn btn-danger btn-lg" hx-post="/ui/api/cu_cancel">Cancel</button>
|
|
<span class="d-inline-block" tabindex="0" data-bs-toggle="tooltip" data-bs-title="Resolve the warnings at the top.">
|
|
<button
|
|
class="btn btn-success btn-lg"
|
|
type="submit"
|
|
hx-post="/ui/api/cu_commit"
|
|
hx-boost="false"
|
|
(( "disabled"|blank_if(warnings.len() == 0) ))
|
|
>Submit Changes</button>
|
|
</span>
|
|
</div>
|
|
</form>
|
|
</div>
|