Skip to content

Commit

Permalink
Improved error layout and handling (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock authored Apr 5, 2022
1 parent e544526 commit 51a2801
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion login/error.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<#if section = "header">
${msg("errorTitle")}
<#elseif section = "form">
<div class="alert alert-error" id="kc-error-message">
<div class="alert alert-error ${properties.kcHeaderClass}" id="kc-error-message">
<p class="instruction">${message.summary}</p>
<#if message.summary = "Unexpected error when authenticating with identity provider">
This error could be caused by your account already having a mapping for CILogon.</br>
Expand Down
11 changes: 8 additions & 3 deletions login/login.ftl
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<#import "template.ftl" as layout>
<@layout.registrationLayout displayInfo=social.displayInfo displayWide=layout.showSocial; section>
<#if realm.password && social.providers?? && ! url.oauthAction?contains("first-broker-login") && client?? && (client.clientId?contains("osc.edu") || client.clientId?contains("kubernetes"))>
<#assign showSocial = true>
<#else>
<#assign showSocial = false>
</#if>
<@layout.registrationLayout displayInfo=social.displayInfo displayWide=showSocial showSocial=showSocial; section>
<#if section = "header">
${msg("doLogIn")}
<#elseif section = "form">
<div id="kc-form" <#if realm.password && social.providers??>class="${properties.kcContentWrapperClass!}"</#if>>
<div id="kc-form-wrapper" <#if layout.showSocial >class="${properties.kcFormSocialAccountContentClass!} ${properties.kcFormSocialAccountClass!}"<#else>class="${properties.kcFormContentClass}"</#if>>
<div id="kc-form-wrapper" <#if showSocial >class="${properties.kcFormSocialAccountContentClass!} ${properties.kcFormSocialAccountClass!}"<#else>class="${properties.kcFormContentClass}"</#if>>
<#if realm.password>
<form id="kc-form-login" onsubmit="login.disabled = true; return true;" action="${url.loginAction}" method="post">
<div class="${properties.kcFormGroupClass!}">
Expand Down Expand Up @@ -58,7 +63,7 @@
</#if>
</#if><#-- <#if realm.password> -->
</div>
<#if layout.showSocial>
<#if showSocial>
<div id="kc-social-providers" class="${properties.kcFormSocialAccountContentClass!} ${properties.kcFormSocialAccountClass!}">
<ul class="${properties.kcFormSocialAccountListClass!} <#if social.providers?size gt 4>${properties.kcFormSocialAccountDoubleListClass!}</#if>">
<#list social.providers as p>
Expand Down
7 changes: 1 addition & 6 deletions login/template.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<#macro registrationLayout bodyClass="" displayInfo=false displayMessage=true displayWide=false>
<#macro registrationLayout bodyClass="" displayInfo=false displayMessage=true displayWide=false showSocial=false>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" class="${properties.kcHtmlClass!}">

Expand Down Expand Up @@ -36,11 +36,6 @@
<#else>
<#assign mapping = false>
</#if>
<#if realm.password && social.providers?? && ! url.oauthAction?contains("first-broker-login") && client?? && (client.clientId?contains("osc.edu") || client.clientId?contains("kubernetes"))>
<#assign showSocial = true>
<#else>
<#assign showSocial = false>
</#if>

<body class="${properties.kcBodyClass!}">
<div class="${properties.kcLoginClass!}">
Expand Down
4 changes: 2 additions & 2 deletions login/theme.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ kcButtonClass=btn
kcButtonPrimaryClass=btn-primary
kcButtonBlockClass=btn-block
kcButtonLargeClass=btn-lg
kcHeaderClass=page-header col-sm-10 col-sm-offset-1 col-md-6 col-md-offset-3
kcHeaderClass=page-header col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2
kcSocialHeaderClass=page-header
#kcHeaderClass=page-header col-sm-10 col-sm-offset-1 col-md-6 col-md-offset-3
kcFormSocialAccountClass=login-pf-social-section
kcFormContentClass=col-sm-10 col-sm-offset-1 col-md-6 col-md-offset-3
kcFormContentClass=col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2
kcFormSocialAccountContentClass=col-xs-12 col-sm-6
kcFormSocialAccountListClass=login-pf-social list-unstyled login-pf-social-all
kcFormSocialAccountDoubleListClass=login-pf-social-double-col
Expand Down

0 comments on commit 51a2801

Please sign in to comment.