Skip to content

Commit

Permalink
Merge pull request #30 from vshn/social-providers
Browse files Browse the repository at this point in the history
Improve the design of the social provider buttons
  • Loading branch information
gerbermichi authored Apr 12, 2023
2 parents f700915 + b96bcfd commit 1ed37d2
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 18 deletions.
5 changes: 0 additions & 5 deletions disable-theme-cache.cli

This file was deleted.

18 changes: 11 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
version: '3.8'
services:
keycloak:
image: quay.io/keycloak/keycloak:15.0.2
image: quay.io/keycloak/keycloak:21.0
ports:
- "8080:8080"
environment:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
KEYCLOAK_DEFAULT_THEME: vshn
KEYCLOAK_WELCOME_THEME: vshn
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
command:
- start-dev
- --debug
- --spi-theme-static-max-age=-1
- --spi-theme-cache-themes=false
- --spi-theme-cache-templates=false
- --spi-theme-login-theme=vshn
volumes:
- ./theme:/opt/jboss/keycloak/themes/vshn:ro
- ./disable-theme-cache.cli:/opt/jboss/startup-scripts/disable-theme-cache.cli:ro
- ./theme:/opt/keycloak/themes/vshn:ro
2 changes: 2 additions & 0 deletions theme/login/messages/messages_en.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
loginAccountTitle=Sign in with VSHN Account or external provider.
identity-provider-login-label=First time here? Just login with an external provider of your choice. For more details see https://kb.vshn.net/kb/vshn-login.
97 changes: 95 additions & 2 deletions theme/login/resources/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
padding-top: 1px;
}

.social-providers h4{
.social-providers h4 {
text-align: center;
}

Expand All @@ -54,7 +54,7 @@
}

.splash-container {
max-width: 500px;
max-width: 700px;
}

#kc-totp-settings {
Expand Down Expand Up @@ -104,3 +104,96 @@
font-size: 1.3rem;
padding-right: 0.25rem;
}

#kc-page-title {
padding: 0 1rem;
font-size: 2rem;
}

#kc-content-wrapper {
display: flex;
flex-direction: row;
}

#kc-form {
width: calc(50% - 1.5rem);
}

#kc-social-providers {
border-left: 2px solid #666666;
padding-left: 3rem;
margin-left: 3rem;
width: calc(50% + 1.5rem);
flex-direction: column-reverse;
display: flex;
align-items: center;
position: relative;
}

#kc-social-providers::before {
content: 'or';
position: absolute;
left: -0.625rem;
top: calc(50% - 0.625rem);
font-size: 1.25rem;
background-color: white;
color: #666666;
}

#kc-social-providers hr {
display: none;
}

#kc-social-providers h4 {
font-weight: 400;
font-size: 1.25rem;
color: #666666;
text-align: left;
width: 100%;
}

.social-account-list {
margin-top: 1rem;
display: flex;
flex-direction: column;
gap: 1rem;
width: 100%;
}

@media all and (max-width: 700px) {
.splash-container {
max-width: 500px;
}

#kc-content-wrapper {
flex-direction: column;
}

#kc-form {
width: 100%;
}

#kc-social-providers {
border: none;
border-top: 2px solid #666666;
padding: 0;
margin: 0;
width: 100%;
padding-top: 2rem;
margin-top: 1.3rem;
flex-direction: column-reverse;
display: flex;
align-items: center;
}

#kc-social-providers::before {
content: 'or';
position: absolute;
left: calc(50% - 1rem);
top: -1rem;
padding: 0 0.5rem;
font-size: 1.25rem;
background-color: white;
color: #666666;
}
}
12 changes: 10 additions & 2 deletions theme/login/resources/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ window.onload = function () {
if (beLogin) {
beLogin.style.visibility = 'visible';
const input = document.querySelector('input');
if(input){
if (input) {
input.focus();
input.select();
input.select();
}
}

replaceLinkWithHref(document.querySelector('#kc-social-providers h4'));

setTimeout(lookAround, 10000);
}

Expand Down Expand Up @@ -137,3 +139,9 @@ function lookAround() {
function reset() {
TweenMax.to('.vshnEye', 1, {x: 0, y: 0, scaleY: 1, scaleX: 1, ease: Expo.easeOut})
}
function replaceLinkWithHref(element) {
const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g;
const text = element.innerText;
element.innerHTML = text.replace(urlRegex, '<a href="$&">$&</a>');
}

4 changes: 2 additions & 2 deletions theme/login/theme.properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ kcWebAuthnKeyIcon=mdi mdi-key

## Social
kcFormSocialAccountSectionClass=social-providers
kcFormSocialAccountListClass=mt-3 mb-3
kcFormSocialAccountListButtonClass=btn btn-space btn-secondary
kcFormSocialAccountListClass=social-account-list
kcFormSocialAccountListButtonClass=btn btn-xl btn-secondary

## Social Icons
kcLogoIdP-facebook=mdi mdi-facebook
Expand Down

0 comments on commit 1ed37d2

Please sign in to comment.