feat: add login oauth grant page (#25)

Co-authored-by: Anthony Lukin <anthony@lukin.dev>
This commit is contained in:
Constantin Wildförster 2022-12-18 03:00:00 +07:00
parent f6cf1205a5
commit f31074f8ec
4 changed files with 69 additions and 8 deletions

View file

@ -9,6 +9,7 @@ Keywind is a component-based Keycloak Login Theme built with [Tailwind CSS](http
- Login - Login
- Login Config TOTP - Login Config TOTP
- Login IDP Link Confirm - Login IDP Link Confirm
- Login OAuth Grant
- Login OTP - Login OTP
- Login Reset Password - Login Reset Password
- Login Update Password - Login Update Password

View file

@ -16,27 +16,27 @@
${msg("loginTotpTitle")} ${msg("loginTotpTitle")}
<#elseif section="form"> <#elseif section="form">
<ol class="list-decimal pl-4 space-y-2"> <ol class="list-decimal pl-4 space-y-2">
<li> <li class="space-y-2">
<p>${msg("loginTotpStep1")}</p> <p>${msg("loginTotpStep1")}</p>
<ul class="list-disc pl-6 py-2 space-y-2"> <ul class="list-disc pl-4">
<#list totp.supportedApplications as app> <#list totp.supportedApplications as app>
<li>${msg(app)}</li> <li>${msg(app)}</li>
</#list> </#list>
</ul> </ul>
</li> </li>
<#if mode?? && mode = "manual"> <#if mode?? && mode = "manual">
<li> <li class="space-y-2">
<p>${msg("loginTotpManualStep2")}</p> <p>${msg("loginTotpManualStep2")}</p>
<p class="font-bold py-2 text-xl">${totp.totpSecretEncoded}</p> <p class="font-bold text-xl">${totp.totpSecretEncoded}</p>
</li> </li>
<li> <li>
<@linkPrimary.kw href=totp.qrUrl> <@linkPrimary.kw href=totp.qrUrl>
${msg("loginTotpScanBarcode")} ${msg("loginTotpScanBarcode")}
</@linkPrimary.kw> </@linkPrimary.kw>
</li> </li>
<li> <li class="space-y-2">
<p>${msg("loginTotpManualStep3")}</p> <p>${msg("loginTotpManualStep3")}</p>
<ul class="list-disc pl-6 py-2 space-y-2"> <ul class="list-disc pl-4">
<li>${msg("loginTotpType")}: ${msg("loginTotp." + totp.policy.type)}</li> <li>${msg("loginTotpType")}: ${msg("loginTotp." + totp.policy.type)}</li>
<li>${msg("loginTotpAlgorithm")}: ${totp.policy.getAlgorithmKey()}</li> <li>${msg("loginTotpAlgorithm")}: ${totp.policy.getAlgorithmKey()}</li>
<li>${msg("loginTotpDigits")}: ${totp.policy.digits}</li> <li>${msg("loginTotpDigits")}: ${totp.policy.digits}</li>
@ -96,7 +96,6 @@
<@buttonPrimary.kw type="submit"> <@buttonPrimary.kw type="submit">
${msg("doSubmit")} ${msg("doSubmit")}
</@buttonPrimary.kw> </@buttonPrimary.kw>
<@buttonSecondary.kw name="cancel-aia" type="submit"> <@buttonSecondary.kw name="cancel-aia" type="submit">
${msg("doCancel")} ${msg("doCancel")}
</@buttonSecondary.kw> </@buttonSecondary.kw>

View file

@ -0,0 +1,61 @@
<#import "template.ftl" as layout>
<#import "components/button/primary.ftl" as buttonPrimary>
<#import "components/button/secondary.ftl" as buttonSecondary>
<@layout.registrationLayout; section>
<#if section="header">
<#if client.attributes.logoUri??>
<img class="mb-4 mx-auto" src="${client.attributes.logoUri}"/>
</#if>
<p>
<#if client.name?has_content>
${msg("oauthGrantTitle", advancedMsg(client.name))}
<#else>
${msg("oauthGrantTitle", client.clientId)}
</#if>
</p>
<#elseif section="form">
<h3>${msg("oauthGrantRequest")}</h3>
<ul class="list-disc pl-4">
<#if oauth.clientScopesRequested??>
<#list oauth.clientScopesRequested as clientScope>
<li>
<#if !clientScope.dynamicScopeParameter??>
${advancedMsg(clientScope.consentScreenText)}
<#else>
${advancedMsg(clientScope.consentScreenText)}: <b>${clientScope.dynamicScopeParameter}</b>
</#if>
</li>
</#list>
</#if>
</ul>
<#if client.attributes.policyUri?? || client.attributes.tosUri??>
<h3>
<#if client.name?has_content>
${msg("oauthGrantInformation",advancedMsg(client.name))}
<#else>
${msg("oauthGrantInformation",client.clientId)}
</#if>
<#if client.attributes.tosUri??>
${msg("oauthGrantReview")}
<a href="${client.attributes.tosUri}" target="_blank">${msg("oauthGrantTos")}</a>
</#if>
<#if client.attributes.policyUri??>
${msg("oauthGrantReview")}
<a href="${client.attributes.policyUri}" target="_blank">${msg("oauthGrantPolicy")}</a>
</#if>
</h3>
</#if>
<form action="${url.oauthAction}" class="m-0 space-y-4" method="POST">
<input name="code" type="hidden" value="${oauth.code}">
<div class="flex flex-col pt-4 space-y-2">
<@buttonPrimary.kw name="accept" type="submit">
${msg("doYes")}
</@buttonPrimary.kw>
<@buttonSecondary.kw name="cancel" type="submit">
${msg("doNo")}
</@buttonSecondary.kw>
</div>
</form>
</#if>
</@layout.registrationLayout>

File diff suppressed because one or more lines are too long