overriding more of the login screen - can't do it all with CSS anymore so overriding one of the ftl files (Whatever they are, not sure, but works)

This commit is contained in:
danfunk 2023-10-06 11:02:11 -04:00
parent 94a01fcc80
commit a83e11c504
3 changed files with 129 additions and 21 deletions

View File

@ -48,16 +48,10 @@ docker run \
-e KEYCLOAK_ADMIN_PASSWORD=admin \ -e KEYCLOAK_ADMIN_PASSWORD=admin \
quay.io/keycloak/keycloak:22.0.4 start-dev \ quay.io/keycloak/keycloak:22.0.4 start-dev \
-Dkeycloak.profile.feature.token_exchange=enabled \ -Dkeycloak.profile.feature.token_exchange=enabled \
-Dkeycloak.profile.feature.admin_fine_grained_authz=enabled -Dkeycloak.profile.feature.admin_fine_grained_authz=enabled \
-D--spi-theme-static-max-age=-1 \
# Add these lines if you want live reloading of changed theme files -D--spi-theme-cache-themes=false \
# Theme files are stored in keycloak/spifftheme. From the keycloak -D--spi-theme-cache-templates=false
# directory run docker cp ./spifftheme keycloak:/opt/keycloak/themes to
# see changes.
# \
# -D--spi-theme-static-max-age=-1 \
# -D--spi-theme-cache-themes=false \
# -D--spi-theme-cache-templates=false
script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
cp "${script_dir}/../realm_exports/${realm_name}-realm.json" /tmp/${realm_name}-realm.json cp "${script_dir}/../realm_exports/${realm_name}-realm.json" /tmp/${realm_name}-realm.json

View File

@ -0,0 +1,110 @@
<#import "template.ftl" as layout>
<@layout.registrationLayout displayMessage=!messagesPerField.existsError('username','password') displayInfo=realm.password && realm.registrationAllowed && !registrationDisabled??; section>
<#if section = "header">
Sign in with password
<#elseif section = "form">
<div id="kc-form">
<div id="kc-form-wrapper">
<#if realm.password>
<form id="kc-form-login" onsubmit="login.disabled = true; return true;" action="${url.loginAction}" method="post">
<#if !usernameHidden??>
<div class="${properties.kcFormGroupClass!}">
<label for="username" class="${properties.kcLabelClass!}"><#if !realm.loginWithEmailAllowed>${msg("username")}<#elseif !realm.registrationEmailAsUsername>${msg("usernameOrEmail")}<#else>${msg("email")}</#if></label>
<input tabindex="1" id="username" class="${properties.kcInputClass!}" name="username" value="${(login.username!'')}" type="text" autofocus autocomplete="off"
aria-invalid="<#if messagesPerField.existsError('username','password')>true</#if>"
/>
<#if messagesPerField.existsError('username','password')>
<span id="input-error" class="${properties.kcInputErrorMessageClass!}" aria-live="polite">
${kcSanitize(messagesPerField.getFirstError('username','password'))?no_esc}
</span>
</#if>
</div>
</#if>
<div class="${properties.kcFormGroupClass!}">
<label for="password" class="${properties.kcLabelClass!}">${msg("password")}</label>
<input tabindex="2" id="password" class="${properties.kcInputClass!}" name="password" type="password" autocomplete="off"
aria-invalid="<#if messagesPerField.existsError('username','password')>true</#if>"
/>
<#if usernameHidden?? && messagesPerField.existsError('username','password')>
<span id="input-error" class="${properties.kcInputErrorMessageClass!}" aria-live="polite">
${kcSanitize(messagesPerField.getFirstError('username','password'))?no_esc}
</span>
</#if>
</div>
<div class="${properties.kcFormGroupClass!} ${properties.kcFormSettingClass!}">
<div id="kc-form-options">
<#if realm.rememberMe && !usernameHidden??>
<div class="checkbox">
<label>
<#if login.rememberMe??>
<input tabindex="3" id="rememberMe" name="rememberMe" type="checkbox" checked> ${msg("rememberMe")}
<#else>
<input tabindex="3" id="rememberMe" name="rememberMe" type="checkbox"> ${msg("rememberMe")}
</#if>
</label>
</div>
</#if>
</div>
<div class="${properties.kcFormOptionsWrapperClass!}">
<#if realm.resetPasswordAllowed>
<span><a tabindex="5" href="${url.loginResetCredentialsUrl}">${msg("doForgotPassword")}</a></span>
</#if>
</div>
</div>
<div id="kc-form-buttons" class="${properties.kcFormGroupClass!}">
<input type="hidden" id="id-hidden-input" name="credentialId" <#if auth.selectedCredential?has_content>value="${auth.selectedCredential}"</#if>/>
<input tabindex="4" class="${properties.kcButtonClass!} ${properties.kcButtonPrimaryClass!} ${properties.kcButtonBlockClass!} ${properties.kcButtonLargeClass!}" name="login" id="kc-login" type="submit" value="${msg("doLogIn")}"/>
</div>
</form>
</#if>
</div>
</div>
<#elseif section = "info" >
<#if realm.password && realm.registrationAllowed && !registrationDisabled??>
<div id="kc-registration-container">
<div id="kc-registration">
<span>${msg("noAccount")} <a tabindex="6"
href="${url.registrationUrl}">${msg("doRegister")}</a></span>
</div>
</div>
</#if>
<#elseif section = "socialProviders" >
<#if realm.password && social.providers??>
<div id="kc-social-providers" class="${properties.kcFormSocialAccountSectionClass!}">
<hr/>
<h4>Or ... </h4>
<ul class="${properties.kcFormSocialAccountListClass!} <#if social.providers?size gt 3>${properties.kcFormSocialAccountListGridClass!}</#if>">
<#list social.providers as p>
<li>
<a id="social-${p.alias}" class="${properties.kcFormSocialAccountListButtonClass!} <#if social.providers?size gt 3>${properties.kcFormSocialAccountGridItem!}</#if>"
type="button" href="${p.loginUrl}">
<#if p.iconClasses?has_content>
<i class="${properties.kcCommonLogoIdP!} ${p.iconClasses!}" aria-hidden="true"></i>
<span class="${properties.kcFormSocialAccountNameClass!} kc-social-icon-text">${p.displayName!}</span>
<#else>
<span class="${properties.kcFormSocialAccountNameClass!}">${p.displayName!}</span>
</#if>
</a>
</li>
</#list>
</ul>
</div>
<div class="followup"><b>New User?</b> Please use one of the provider buttons above to register automatically. If you
do not have an account with one of these providers, you can request a login link via email by
sending a request to <a href="mailto:support@spiffworkflow.com">support@spiffworkflow.com</a></div>
</#if>
</#if>
</@layout.registrationLayout>

View File

@ -14,9 +14,11 @@
} }
.login-pf-page .login-pf-header h1 { .login-pf-page .login-pf-header h1, .kc-social-section h4 {
font-size: 2rem; font-size: 2rem;
line-height: 2.5rem; line-height: 2.5rem;
font-weight: 100;
text-align: center;
} }
.login-pf-page-header { .login-pf-page-header {
@ -30,9 +32,6 @@
display: none; display: none;
} }
#kc-social-providers:after {
content: 'You can also request a login link via email by sending a request to support@spiffworkflow.com';
}
.card-pf { .card-pf {
margin: 0 auto; margin: 0 auto;
@ -46,8 +45,8 @@
} }
.pf-c-button.pf-m-primary { .pf-c-button.pf-m-primary {
background: #FF7A59; background: #126d82;
border-color: #FF7A59; border-color: #126d82;
border-radius: 15px; border-radius: 15px;
color: #FFFFFF; color: #FFFFFF;
font-size: 1.2rem; font-size: 1.2rem;
@ -56,13 +55,13 @@
} }
.pf-c-button.kc-social-item { .pf-c-button.kc-social-item {
background: #126d82; background: #FF7A59;
border-color: #126d82; border-color: #FF7A59;
border-radius: 15px; border-radius: 15px;
color: #FFFFFF; color: #FFFFFF;
font-size: 1rem; font-size: 1.2rem;
line-height: 1.5rem; line-height: 2.5rem;
font-weight: 500; font-weight: 700;
padding: 10px; padding: 10px;
--pf-c-button--after--BorderColor: none; --pf-c-button--after--BorderColor: none;
} }
@ -72,3 +71,8 @@
.pf-c-login__main-footer-links.kc-social-links { .pf-c-login__main-footer-links.kc-social-links {
display: block; display: block;
} }
.followup {
font-size: 1.1em;
margin: 10px;
}