Skip to content

Commit

Permalink
feat: redesign of Keycloak login theme (#135)
Browse files Browse the repository at this point in the history
* chore: small fixes

* Update organization create and onboard page HTML

* Update logo and font styles

* docs: append Changelog

* fix: band-aided OTP form

---------

Co-authored-by: Kamil Czaja <[email protected]>
Co-authored-by: Kamil Czaja <[email protected]>
  • Loading branch information
3 people authored Mar 22, 2024
1 parent 0e7adcf commit d0b1bec
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 49 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ please see [changelog_updates.md](docs/dev/changelog_updates.md).
- Fixed an issue where upon clicking "back to application" on the logout confirmation page, the user would appear to be logged out instead of the logout being canceled ([#8](https://github.com/sovity/authority-portal/issues/8))
- Fixed redirection to broker catalog with participant's data offers pre-filtered ([#44](https://github.com/sovity/authority-portal/issues/44))
- Fixed an issue where an error 403 would be displayed under certain circumstances ([#107](https://github.com/sovity/authority-portal/issues/107))
- Changed Keycloak custom theme for login and logout pages [#113](https://github.com/sovity/authority-portal/issues/113)
- Fixed an issue where deleting the last user of an organization would delete the organization but leave the user in an invalid state ([#45](https://github.com/sovity/authority-portal/issues/45))
- Changed the Keycloak realm ID to `mds-portal` ([#139](https://github.com/sovity/authority-portal/issues/139))
- Fixed dashboard for non-authority users ([#118](https://github.com/sovity/authority-portal/issues/118))
Expand All @@ -37,6 +38,7 @@ please see [changelog_updates.md](docs/dev/changelog_updates.md).
### Known issues

- Due to the change of the Keycloak realm name, some auth-related URLs might be outdated in your browser. If you run into this issue. please clear your browser cache and hard-reload the page.
- Login and first-login related Keycloak pages may look broken. This will be fixed in the next release.

### Deployment Migration Notes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
src="assets/images/mds_logo_black.svg"
alt="Mobility Data Space Logo" />
<div class="max-w-2xl mx-auto text-center">
<h1 class="full-screen-end-title">MDS Portal</h1>
<p class="full-screen-end-prose max-w-md">
If your organization is already participating in the MDS, please ask your
organization's administrator to invite you.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
<!-- header -->
<div
class="top-0 p-8 bg-white flex justify-start items-center cursor-pointer">
<img src="/assets/images/logo_light.svg" alt="logo" />
<div>
<p class="mx-4 leading-5 font-bold text-black">
Mobility <br />
Data Space<br />
Portal
</p>
</div>
<img src="/assets/images/mds_logo_black.svg" alt="logo" />
</div>
<!-- header -->

Expand Down
58 changes: 58 additions & 0 deletions authority-portal-keycloak/mds-theme/login/login-otp.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<#import "template.ftl" as layout>
<@layout.registrationLayout displayMessage=!messagesPerField.existsError('totp'); section>
<#if section="header">
${msg("doLogIn")}
<#elseif section="form">
<form id="kc-otp-login-form" class="${properties.kcFormClass!}" action="${url.loginAction}"
method="post">
<#if otpLogin.userOtpCredentials?size gt 1>
<div class="${properties.kcFormGroupClass!}">
<div class="${properties.kcInputWrapperClass!}">
<#list otpLogin.userOtpCredentials as otpCredential>
<input id="kc-otp-credential-${otpCredential?index}" class="${properties.kcLoginOTPListInputClass!}" type="radio" name="selectedCredentialId" value="${otpCredential.id}" <#if otpCredential.id == otpLogin.selectedCredentialId>checked="checked"</#if>>
<label for="kc-otp-credential-${otpCredential?index}" class="${properties.kcLoginOTPListClass!}" tabindex="${otpCredential?index}">
<span class="${properties.kcLoginOTPListItemHeaderClass!}">
<span class="${properties.kcLoginOTPListItemIconBodyClass!}">
<i class="${properties.kcLoginOTPListItemIconClass!}" aria-hidden="true"></i>
</span>
<span class="${properties.kcLoginOTPListItemTitleClass!}">${otpCredential.userLabel}</span>
</span>
</label>
</#list>
</div>
</div>
</#if>

<div class="${properties.kcFormGroupClass!}">
<div class="${properties.kcLabelWrapperClass!}">
<label for="otp" class="${properties.kcLabelClass!}">${msg("loginOtpOneTime")}</label>
</div>

<div class="${properties.kcInputWrapperClass!}">
<input id="otp" name="otp" autocomplete="off" type="text" class="text-input"
autofocus aria-invalid="<#if messagesPerField.existsError('totp')>true</#if>"/>

<#if messagesPerField.existsError('totp')>
<span id="input-error-otp-code" class="${properties.kcInputErrorMessageClass!}"
aria-live="polite">
${kcSanitize(messagesPerField.get('totp'))?no_esc}
</span>
</#if>
</div>
</div>

<div class="${properties.kcFormGroupClass!}">
<div id="kc-form-options" class="${properties.kcFormOptionsClass!}">
<div class="${properties.kcFormOptionsWrapperClass!}">
</div>
</div>

<div id="kc-form-buttons" class="${properties.kcFormButtonsClass!}">
<input
class="${properties.kcButtonClass!} ${properties.kcButtonPrimaryClass!} ${properties.kcButtonBlockClass!} ${properties.kcButtonLargeClass!}"
name="login" id="kc-login" type="submit" value="${msg("doLogIn")}" />
</div>
</div>
</form>
</#if>
</@layout.registrationLayout>
3 changes: 0 additions & 3 deletions authority-portal-keycloak/mds-theme/login/login.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
<#if section = "header">
<#elseif section = "form">
<div class="formContainer">
<div class="formHeader">
<h3>USER LOGIN</h3>
</div>
<div class="formBody">
<div id="kc-form">
<div id="kc-form-wrapper">
Expand Down
38 changes: 38 additions & 0 deletions authority-portal-keycloak/mds-theme/login/logout-confirm.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<#import "template.ftl" as layout>
<@layout.registrationLayout; section>
<#if section = "header">
${msg("logoutConfirmTitle")}
<#elseif section = "form">
<div id="kc-logout-confirm" class="content-area">
<h3 class="instruction">${msg("logoutConfirmHeader")}</h3>

<form class="form-actions" action="${url.logoutConfirmAction}" method="POST">
<input type="hidden" name="session_code" value="${logoutConfirm.code}">
<div class="${properties.kcFormGroupClass!}">
<div id="kc-form-options">
<div class="${properties.kcFormOptionsWrapperClass!}">
</div>
</div>

<div id="kc-form-buttons" class="${properties.kcFormGroupClass!}">
<input tabindex="4"
class="${properties.kcButtonClass!} ${properties.kcButtonPrimaryClass!} ${properties.kcButtonBlockClass!} ${properties.kcButtonLargeClass!}"
name="confirmLogout" id="kc-logout" type="submit" value="${msg("doLogout")}"/>
</div>

</div>
</form>

<div id="kc-info-message">
<#if logoutConfirm.skipLink>
<#else>
<#if (client.baseUrl)?has_content>
<h4><a href="${client.baseUrl}">${kcSanitize(msg("backToApplication"))?no_esc}</a></h4>
</#if>
</#if>
</div>

<div class="clearfix"></div>
</div>
</#if>
</@layout.registrationLayout>
79 changes: 44 additions & 35 deletions authority-portal-keycloak/mds-theme/login/resources/css/login.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
html {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
}

* {
font-family: Arial, Helvetica, sans-serif;
}

form {
width: 100%;
}

a {
color: #9ca3af !important;
}

a:hover {
color: #ffc000 !important;
}

.login-pf {
background: white !important;
}
Expand All @@ -15,21 +28,35 @@ form {
background: white repeat-x 50% 0 !important;
}

.login-pf-page {
display: flex;
flex-direction: column;
width: 100vw;
height: 100vh;
justify-content: center;
align-items: center;
}

/* default - IE compatibility */
.pf-m-primary {
display: block;
background-color: #fdfd09 !important;
background-color: black !important;
color: white;
text-transform: uppercase;
border-radius: 0.25rem;
line-height: 1;
border-radius: 50px;
height: 2.5em;
margin: 0 auto;
padding: 0 2em;
padding: 0 5em 0 5em;
border: none;
cursor: pointer;
transition: all 0.2s ease-in-out;
}

.pf-m-primary:hover {
color: #ffc000 !important;
}

/* default - IE compatibility */
.pf-c-button.pf-m-control {
border: solid 1px;
Expand Down Expand Up @@ -77,7 +104,7 @@ h1#kc-page-title {
}

#kc-content {
width: 100%;
width: 35rem;
}

#kc-attempted-username {
Expand All @@ -97,14 +124,6 @@ h1#kc-page-title {
padding-top: 8px;
}

#kc-content-wrapper {
margin-top: 20px;
}

#kc-form-wrapper {
margin-top: 10px;
}

#kc-info-wrapper {
font-size: 13px;
}
Expand Down Expand Up @@ -176,12 +195,6 @@ ul#kc-totp-supported-apps {
background: #ffffff no-repeat center center fixed;
background-size: cover;
}

.login-pf-page {
padding-top: 0px;
min-height: 100vh;
overflow: auto;
}
}

.card-pff {
Expand All @@ -190,8 +203,6 @@ ul#kc-totp-supported-apps {
max-width: 500px;
border-radius: 25px;
height: auto;
margin-top: 40px;
margin-bottom: 100px;
}

.login-pf-page .login-pf-signup {
Expand Down Expand Up @@ -246,10 +257,7 @@ ul#kc-totp-supported-apps {
.cardContainer {
display: flex;
flex-direction: column;
background-color: #f2f2f2;
padding: 20px;
border-radius: 4px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

.formContainer {
Expand All @@ -271,10 +279,17 @@ ul#kc-totp-supported-apps {
border: 1px solid #474747;
margin: 10px auto;
color: rgb(0, 0, 0);
background-color: rgba(0, 0, 0, 0.1);
background-color: white !important;
text-align: center;
border-radius: 0.5rem;
padding: 0.5rem;
padding: 1.5rem;
}

#kc-logout-confirm {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}

.text-input::placeholder {
Expand All @@ -287,7 +302,7 @@ ul#kc-totp-supported-apps {
background-image: url(../img/truzzt.png);
background-repeat: no-repeat;
background-position: top;
height: 110px;
height: 80px;
max-width: 350px;
background-size: 63%;
}
Expand Down Expand Up @@ -316,17 +331,11 @@ div.form-group.login-pf-settings {
margin-bottom: 10px !important;
max-width: 211px;
height: 40px;
margin-bottom: 70px;
border-radius: 30px;
color: #202020;
background-color: black;
color: white;
font-weight: 600;
font-size: 14px;
line-height: 17px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pf-c-button.pf-m-primary.pf-m-block.btn-lg:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.kc-registration-container.a:link {
Expand Down Expand Up @@ -385,4 +394,4 @@ div.form-group.login-pf-settings {
.legal-notices {
display: flex;
justify-content: center;
}
}
6 changes: 4 additions & 2 deletions authority-portal-keycloak/mds-theme/login/template.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,29 @@
<div class="col-md-10">
<#nested "show-username">
<div id="kc-username" class="${properties.kcFormGroupClass!}">
<label id="kc-attempted-username">${auth.attemptedUsername}</label>
<a id="reset-login" href="${url.loginRestartFlowUrl}" aria-label="${msg("restartLoginTooltip")}">
<div class="kc-login-tooltip">
<i class="${properties.kcResetFlowIcon!}"></i>
<span class="kc-tooltip-text">${msg("restartLoginTooltip")}</span>
</div>
</a>
</div>
<br>
<br>
</div>
</div>
<#else>
<#nested "show-username">
<div id="kc-username" class="${properties.kcFormGroupClass!}">
<label id="kc-attempted-username">${auth.attemptedUsername}</label>
<a id="reset-login" href="${url.loginRestartFlowUrl}" aria-label="${msg("restartLoginTooltip")}">
<div class="kc-login-tooltip">
<i class="${properties.kcResetFlowIcon!}"></i>
<span class="kc-tooltip-text">${msg("restartLoginTooltip")}</span>
</div>
</a>
</div>
<br>
<br>
</#if>
</#if>
</header>
Expand Down

0 comments on commit d0b1bec

Please sign in to comment.