Skip to content

Commit

Permalink
Merge pull request #41 from mitodl/nl/ux-mvp
Browse files Browse the repository at this point in the history
SSO UI MVP
  • Loading branch information
rhysyngsun authored Mar 26, 2024
2 parents cf9a248 + a9463d8 commit 7b07a5c
Show file tree
Hide file tree
Showing 18 changed files with 881 additions and 783 deletions.
5 changes: 5 additions & 0 deletions .gitguardian.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: 2
secret:
ignore:
- name:
match: "kcFormPasswordVisibilityButtonClass=pf-v5-c-button pf-m-plain"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ ol-keycloak/ol-spi/target/*
ol-keycloak/oltheme/target/*
.DS_Store
plugins/
node_modules/
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "f12edd9c7be1c20cfa42420fd0e6df71e42b51ea"
hooks:
- id: prettier
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
args: ["--baseline", ".secrets.baseline"]
15 changes: 15 additions & 0 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// prettier.config.js, .prettierrc.js, prettier.config.mjs, or .prettierrc.mjs

/** @type {import("prettier").Config} */
const config = {
overrides: [
{
files: ["*.ftl"],
options: {
parser: "html",
},
},
],
};

export default config;
126 changes: 126 additions & 0 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"version": "1.4.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
},
{
"name": "AWSKeyDetector"
},
{
"name": "AzureStorageKeyDetector"
},
{
"name": "Base64HighEntropyString",
"limit": 4.5
},
{
"name": "BasicAuthDetector"
},
{
"name": "CloudantDetector"
},
{
"name": "DiscordBotTokenDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
},
{
"name": "IbmCloudIamDetector"
},
{
"name": "IbmCosHmacDetector"
},
{
"name": "JwtTokenDetector"
},
{
"name": "KeywordDetector",
"keyword_exclude": ""
},
{
"name": "MailchimpDetector"
},
{
"name": "NpmDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "SendGridDetector"
},
{
"name": "SlackDetector"
},
{
"name": "SoftlayerDetector"
},
{
"name": "SquareOAuthDetector"
},
{
"name": "StripeDetector"
},
{
"name": "TwilioKeyDetector"
}
],
"filters_used": [
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
},
{
"path": "detect_secrets.filters.gibberish.should_exclude_secret",
"limit": 3.7
},
{
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
},
{
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
},
{
"path": "detect_secrets.filters.heuristic.is_lock_file"
},
{
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
},
{
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
},
{
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
},
{
"path": "detect_secrets.filters.heuristic.is_sequential_string"
},
{
"path": "detect_secrets.filters.heuristic.is_swagger_file"
},
{
"path": "detect_secrets.filters.heuristic.is_templated_secret"
}
],
"results": {
".pre-commit-config.yaml": [
{
"type": "Hex High Entropy String",
"filename": ".pre-commit-config.yaml",
"hashed_secret": "93b6a9c0402c7516c5c416ae0bbce27bd2ef9e97",
"is_verified": false,
"line_number": 12
}
]
},
"generated_at": "2024-03-20T21:23:15Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,19 @@ public OlFreeMarkerLoginFormsProvider(KeycloakSession session) {
protected void createCommonAttributes(Theme theme, Locale locale, Properties messagesBundle, UriBuilder baseUriBuilder, LoginFormsPages page) {
super.createCommonAttributes(theme, locale, messagesBundle,baseUriBuilder,page);
if (page == LOGIN) {
String firstName = "";
String attemptedName = "";
Boolean hasCredentials = false;
UserModel user = context.getUser();
if (context.getUser() != null) {
firstName = user.getFirstName();
if (user != null) {
if (user.getFirstName() != null && user.getLastName() != null) {
attemptedName = user.getFirstName().concat(" ").concat(user.getLastName());
}

Stream<CredentialModel> credentials = user.credentialManager().getStoredCredentialsStream();
hasCredentials = credentials.count() > 0;

}
this.attributes.put("firstName", firstName);
this.attributes.put("attemptedName", attemptedName);
this.attributes.put("hasCredentials", hasCredentials);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<a href="https://mit.edu" class="logo-link">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1680 1040" enable-background="new 0 0 1680 1040" xml:space="preserve">
<path d="M880,880h160V400H880V880z M1120,320h400V160h-400V320z M880,160.00003h160v160H880V160.00003z M640,880h160V160H640V880z
M400,720h160V160H400V720z M160,880h160V160H160V880z M1120,880h160V400h-160V880z"/>
</svg>
Open
</a>
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
<div class="${properties.kcFormGroupClass!} no-bottom-margin">
<label for="password" class="${properties.kcLabelClass!}">${msg("password")}</label>
<div class="${properties.kcInputGroup!}">
<input tabindex="2" id="password" class="${properties.kcInputClass!}" name="password"
type="password" autocomplete="on" autofocus
aria-invalid="<#if messagesPerField.existsError('password')>true</#if>"
/>
<button class="pf-c-button pf-m-control" type="button" aria-label="${msg('showPassword')}"
aria-controls="password" data-password-toggle
data-label-show="${msg('showPassword')}" data-label-hide="${msg('hidePassword')}">
</button>
<div class="pf-v5-u-display-flex ${properties.kcInputClass!}">
<input tabindex="2" id="password" name="password"
type="password" autocomplete="on" autofocus
aria-invalid="<#if messagesPerField.existsError('password')>true</#if>"
/>
<button class="pf-v5-c-button pf-m-plain pf-v5-u-ml-auto" type="button" aria-label="${msg('showPassword')}"
aria-controls="password" data-password-toggle
data-label-show="${msg('showPassword')}" data-label-hide="${msg('hidePassword')}">
</button>
</div>
</div>
<#if messagesPerField.existsError('password')>
<span id="input-error-password" class="${properties.kcInputErrorMessageClass!}" aria-live="polite">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div id="kc-form-wrapper">
<#if realm.password>
<form id="kc-form-login" onsubmit="login.disabled = true; return true;" action="${url.loginAction}"
method="post">
method="post" class="${properties.kcFormClass}">
<#if !usernameHidden??>
<div class="${properties.kcFormGroupClass!}">
<label for="username"
Expand Down Expand Up @@ -54,7 +54,11 @@
</#if>
</div>
</div>

<#elseif section = "socialProviders" >
<div class="separator pf-v5-u-py-md">
<span class="pf-v5-u-px-md">or</span>
</div>
<#include "social-providers.ftl">
<#elseif section = "info" >
<#if realm.password && realm.registrationAllowed && !registrationDisabled??>
<div id="kc-registration">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
<#import "template.ftl" as layout>
<@layout.registrationLayout displayInfo=true; section>
<@layout.registrationLayout displayInfo=true displayMessage=false; section>
<#if section = "header">
${msg("emailVerifyTitle")}
<#elseif section = "form">
<p class="instruction">${msg("emailVerifyInstruction1",user.email)}</p>
<#elseif section = "info">
<p class="instruction">
${msg("emailVerifyInstruction2")}
<br/>
<div id="kc-form-buttons" class="form-group">
<a class="pf-c-button pf-m-primary pf-m-block btn-lg" href="${url.loginAction}">${msg("emailVerifyInstruction3")}</a>
</div>
${msg("emailVerifyInstruction1")}
<br/>
<b>${user.email}</b>
</p>
<#elseif section = "info">
<p class="pf-v5-u-my-md">${msg("emailVerifyInstruction2")}</p>
<hr />
<p class="pf-v5-u-my-md">${msg("emailVerifyInstruction3")}</p>
<p class="pf-v5-u-my-md">
<b>${msg("emailVerifyInstruction4Bold")}</b>
${msg("emailVerifyInstruction4")}
<a href="#">${msg("emailVerifySupportLinkTitle")}</a>.
</p>
<div id="ol-email-verify-instructions">
<div>
<span id="email-verify-instruction-red">${msg("emailVerifyInstructionOL1")}</span>
</div>
<div>
<b>${msg("emailVerifyInstructionOL2Bold")}</b> ${msg("emailVerifyInstructionOL2")}
</div>
<div>
<b>${msg("emailVerifyInstructionOL3Bold")}</b> ${msg("emailVerifyInstructionOL3")}
</div>
<div>
<b>${msg("emailVerifyInstructionOL4Bold")}</b> ${msg("emailVerifyInstructionOL4")}
</div>
<hr>
<div>
<b>${msg("emailVerifyInstructionOL5Bold")}</b> ${msg("emailVerifyInstructionOL5")}
<br>
<a href="google.com">${msg("emailVerifySupportLinkTitleOL")}</a>
</div>
</div>
</#if>
</@layout.registrationLayout>
Loading

0 comments on commit 7b07a5c

Please sign in to comment.