feat: add delete-credential.ftl

This commit is contained in:
Klaus Betz 2024-05-16 16:27:43 +02:00
parent 65cde81546
commit e7862a21d0
3 changed files with 18 additions and 2 deletions

View file

@ -0,0 +1,16 @@
<#import "template.ftl" as layout>
<#import "components/atoms/button.ftl" as button>
<@layout.registrationLayout displayMessage=false; section>
<#if section = "header">
${msg("deleteCredentialTitle", credentialLabel)}
<#elseif section = "form">
<div id="kc-delete-text">
${msg("deleteCredentialMessage", credentialLabel)}
</div>
<form class="form-actions space-y-1" action="${url.loginAction}" method="POST">
<@button.kw name="accept" color="primary" type="submit">${msg("doConfirmDelete")}</@button.kw>
<@button.kw name="cancel-aia" color="secondary" type="submit">${msg("doCancel")}</@button.kw>
</form>
</#if>
</@layout.registrationLayout>

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{m as T}from"./assets/module.esm-9a996e1c.js";import{b as a}from"./assets/index-a7b84447.js";document.addEventListener("alpine:init",()=>{T.data("webAuthnRegister",function(){const{attestationObjectInput:m,authenticatorLabelInput:g,clientDataJSONInput:A,errorInput:I,publicKeyCredentialIdInput:w,registerForm:s,transportsInput:C}=this.$refs,{attestationConveyancePreference:u,authenticatorAttachment:c,challenge:K,createTimeout:l,excludeCredentialIds:v,requireResidentKey:p,rpEntityName:S,rpId:P,signatureAlgorithms:R,unsupportedBrowserText:x,userId:E,userVerificationRequirement:d,username:f}=this.$store.webAuthnRegister,L=t=>{const e=[];return t===""?(e.push({alg:-7,type:"public-key"}),e):(t.split(",").forEach(r=>{e.push({alg:parseInt(r),type:"public-key"})}),e)},q=t=>{const e=[];return t===""||t.split(",").forEach(r=>{e.push({id:a.parse(r,{loose:!0}),type:"public-key"})}),e},N=t=>{if(t===""||t.constructor!==Array)return"";let e="";return t.forEach(i=>{e+=i+","}),e.slice(0,-1)};return{registerSecurityKey:()=>{if(!window.PublicKeyCredential){I.value=x,s.submit();return}const t={challenge:a.parse(K,{loose:!0}),pubKeyCredParams:L(R),rp:{id:P,name:S},user:{displayName:f,id:a.parse(E,{loose:!0}),name:f}};u!=="not specified"&&(t.attestation=u);const e={};let i=!1;c!=="not specified"&&(e.authenticatorAttachment=c,i=!0),p!=="not specified"&&(p==="Yes"?e.requireResidentKey=!0:e.requireResidentKey=!1,i=!0),d!=="not specified"&&(e.userVerification=d,i=!0),i&&(t.authenticatorSelection=e);const r=q(v);r.length>0&&(t.excludeCredentials=r),parseInt(l)!==0&&(t.timeout=parseInt(l)*1e3),navigator.credentials.create({publicKey:t}).then(n=>{if(n instanceof PublicKeyCredential&&n.response instanceof AuthenticatorAttestationResponse){const{getTransports:h}=n.response;window.result=n;const O=n.rawId;if(m.value=a.stringify(new Uint8Array(n.response.attestationObject),{pad:!1}),A.value=a.stringify(new Uint8Array(n.response.clientDataJSON),{pad:!1}),w.value=a.stringify(new Uint8Array(O),{pad:!1}),typeof h=="function"){const b=h();b&&(C.value=N(b))}else console.log("Your browser is not able to recognize supported transport media for the authenticator.");const y="WebAuthn Authenticator (Default Label)";let o=window.prompt("Please input your registered authenticator's label",y);o===null&&(o=y),g.value=o,s.submit()}}).catch(function(n){n.value=n,s.submit()})}}})});
import{m as N}from"./assets/module.esm-9a996e1c.js";import{b as a}from"./assets/index-a7b84447.js";document.addEventListener("alpine:init",()=>{N.data("webAuthnRegister",function(){const{attestationObjectInput:m,authenticatorLabelInput:g,clientDataJSONInput:A,errorInput:u,publicKeyCredentialIdInput:I,registerForm:s,transportsInput:w}=this.$refs,{attestationConveyancePreference:c,authenticatorAttachment:l,challenge:C,createTimeout:p,excludeCredentialIds:K,requireResidentKey:d,rpEntityName:v,rpId:S,signatureAlgorithms:P,unsupportedBrowserText:R,userId:x,userVerificationRequirement:f,username:h}=this.$store.webAuthnRegister,E=t=>{const e=[];return t===""?(e.push({alg:-7,type:"public-key"}),e):(t.split(",").forEach(i=>{e.push({alg:parseInt(i),type:"public-key"})}),e)},L=t=>{const e=[];return t===""||t.split(",").forEach(i=>{e.push({id:a.parse(i,{loose:!0}),type:"public-key"})}),e},T=t=>{if(t===""||t.constructor!==Array)return"";let e="";return t.forEach(n=>{e+=n+","}),e.slice(0,-1)};return{registerSecurityKey:()=>{if(!window.PublicKeyCredential){u.value=R,s.submit();return}const t={challenge:a.parse(C,{loose:!0}),pubKeyCredParams:E(P),rp:{id:S,name:v},user:{displayName:h,id:a.parse(x,{loose:!0}),name:h}};c!=="not specified"&&(t.attestation=c);const e={};let n=!1;l!=="not specified"&&(e.authenticatorAttachment=l,n=!0),d!=="not specified"&&(d==="Yes"?e.requireResidentKey=!0:e.requireResidentKey=!1,n=!0),f!=="not specified"&&(e.userVerification=f,n=!0),n&&(t.authenticatorSelection=e);const i=L(K);i.length>0&&(t.excludeCredentials=i),parseInt(p)!==0&&(t.timeout=parseInt(p)*1e3),navigator.credentials.create({publicKey:t}).then(r=>{if(r instanceof PublicKeyCredential&&r.response instanceof AuthenticatorAttestationResponse){window.result=r;const q=r.rawId;if(m.value=a.stringify(new Uint8Array(r.response.attestationObject),{pad:!1}),A.value=a.stringify(new Uint8Array(r.response.clientDataJSON),{pad:!1}),I.value=a.stringify(new Uint8Array(q),{pad:!1}),typeof r.response.getTransports=="function"){const b=r.response.getTransports();b&&(w.value=T(b))}else console.log("Your browser is not able to recognize supported transport media for the authenticator.");const y="WebAuthn Authenticator (Default Label)";let o=window.prompt("Please input your registered authenticator's label",y);o===null&&(o=y),g.value=o,s.submit()}}).catch(function(r){u.value=r,s.submit()})}}})});