Initial commit

This commit is contained in:
@lukin 2021-07-05 18:40:00 +07:00
commit 6cd0cd5a60
46 changed files with 3628 additions and 0 deletions

11
.editorconfig Normal file
View file

@ -0,0 +1,11 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
# dependencies
node_modules/
# misc
.DS_Store

201
LICENSE Normal file
View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1,8 @@
{
"themes": [
{
"name": "keywind",
"types": ["login"]
}
]
}

73
README.md Normal file
View file

@ -0,0 +1,73 @@
# :wind_face: Keywind
Keywind is a component-based Keycloak Login Theme built with [Tailwind CSS](https://github.com/tailwindlabs/tailwindcss) and [Alpine.js](https://github.com/alpinejs/alpine).
![Preview](./preview.png)
## Installation
Keywind has been designed with component-based architecture from the start, and **you can customize as little or as much Keywind as you need**:
1. [Deploy Keywind Login Theme](https://www.keycloak.org/docs/latest/server_development/#deploying-themes)
2. [Create your own Login Theme](https://www.keycloak.org/docs/latest/server_development/#creating-a-theme)
3. Specify parent theme in [theme properties](https://www.keycloak.org/docs/latest/server_development/#theme-properties):
```
parent=keywind
```
4. Brand and Customize components with [FreeMaker](https://freemarker.apache.org/docs/dgui_quickstart_template.html)
## Features
### Styled Pages
* Login
* Password Reset
* Register
## Examples
### Color Theme
When you do need to customize a palette, you can configure your colors under the `colors` key in the `theme` section of `tailwind.config.js` file:
```js
// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
primary: colors.red,
},
},
},
}
```
Read more about Tailwind CSS configuration in the [documentation](https://tailwindcss.com/docs/configuration).
### Primary Button Size
You can inherit Keywind components in your own theme. For example, to resize the primary button you should create a styled `theme/mytheme/components/button/primary.ftl` file:
```
<#macro kw component="button" rest...>
<${component}
class="bg-primary-600 flex justify-center px-6 py-3 relative rounded-lg text-md text-white w-full focus:outline-none focus:ring-2 focus:ring-primary-600 focus:ring-offset-2 hover:bg-primary-700"
<#list rest as attrName, attrValue>
${attrName}="${attrValue}"
</#list>
>
<#nested>
</${component}>
</#macro>
```
### Build
When you're ready to deploy your own theme, run the build command to generate a static production build.
```bash
yarn build
```

19
package.json Normal file
View file

@ -0,0 +1,19 @@
{
"scripts": {
"start": "snowpack dev",
"build": "snowpack build"
},
"devDependencies": {
"@snowpack/plugin-postcss": "^1.4.3",
"@tailwindcss/forms": "^0.3.3",
"@types/tailwindcss": "^2.2.1",
"autoprefixer": "^10.2.6",
"cssnano": "^5.0.6",
"postcss": "^8.3.5",
"snowpack": "^3.7.1",
"tailwindcss": "^2.2.4"
},
"dependencies": {
"alpinejs": "^3.2.1"
}
}

7
postcss.config.js Normal file
View file

@ -0,0 +1,7 @@
module.exports = {
plugins: {
autoprefixer: {},
cssnano: {},
tailwindcss: {},
},
};

BIN
preview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

21
snowpack.config.js Normal file
View file

@ -0,0 +1,21 @@
/**
* @type { import("snowpack").SnowpackUserConfig }
*/
module.exports = {
buildOptions: {
out: './theme/keywind/login/resources',
},
devOptions: {
tailwindConfig: './tailwind.config.js',
},
mount: {
src: '/dist',
},
optimize: {
bundle: true,
entrypoints: ['./src/index.js'],
minify: true,
target: 'es2017',
},
plugins: ['@snowpack/plugin-postcss'],
};

26
src/index.css Normal file
View file

@ -0,0 +1,26 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer components {
/* Separate
======================================================================== */
.separate {
@apply flex items-center text-center;
}
.separate::after,
.separate::before {
content: '';
@apply border-b border-gray-300 flex-1;
}
.separate:not(:empty)::after {
@apply ml-2;
}
.separate:not(:empty)::before {
@apply mr-2;
}
}

5
src/index.js Normal file
View file

@ -0,0 +1,5 @@
import Alpine from 'alpinejs';
window.Alpine = Alpine;
Alpine.start();

18
tailwind.config.js Normal file
View file

@ -0,0 +1,18 @@
const colors = require('tailwindcss/colors');
/**
* @type { import('@types/tailwindcss/tailwind-config').TailwindConfig }
*/
module.exports = {
darkMode: 'class',
plugins: [require('@tailwindcss/forms')],
purge: ['./theme/**/*.ftl'],
mode: 'jit',
theme: {
extend: {
colors: {
primary: colors.blue,
},
},
},
};

View file

@ -0,0 +1,10 @@
<#macro kw component="span" rest...>
<${component}
class="absolute left-0 ml-3 text-lg"
<#list rest as attrName, attrValue>
${attrName}="${attrValue}"
</#list>
>
<#nested>
</${component}>
</#macro>

View file

@ -0,0 +1,10 @@
<#macro kw component="button" rest...>
<${component}
class="bg-primary-600 flex justify-center px-4 py-2 relative rounded-lg text-sm text-white w-full focus:outline-none focus:ring-2 focus:ring-primary-600 focus:ring-offset-2 hover:bg-primary-700"
<#list rest as attrName, attrValue>
${attrName}="${attrValue}"
</#list>
>
<#nested>
</${component}>
</#macro>

View file

@ -0,0 +1,17 @@
<#macro kw name checked=false rest...>
<div class="flex items-center">
<input
<#if checked>checked</#if>
class="border-gray-300 h-4 rounded text-primary-600 w-4 focus:ring-primary-200 focus:ring-opacity-50"
id="${name}"
name="${name}"
type="checkbox"
<#list rest as attrName, attrValue>
${attrName}="${attrValue}"
</#list>
>
<label class="block ml-2 text-gray-900 text-sm" for="${name}">
<#nested>
</label>
</div>
</#macro>

View file

@ -0,0 +1,31 @@
<#macro kw>
<title>${msg("loginTitle", (realm.displayName!""))}</title>
<meta charset="utf-8" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<#if properties.meta?has_content>
<#list properties.meta?split(" ") as meta>
<meta name="${meta?split('==')[0]}" content="${meta?split('==')[1]}"/>
</#list>
</#if>
<#if properties.favicons?has_content>
<#list properties.favicons?split(" ") as favicon>
<link href="${url.resourcesPath}/${favicon?split('==')[0]}" rel="${meta?split('==')[1]}">
</#list>
</#if>
<#if properties.styles?has_content>
<#list properties.styles?split(" ") as style>
<link href="${url.resourcesPath}/${style}" rel="stylesheet" />
</#list>
</#if>
<#if properties.scripts?has_content>
<#list properties.scripts?split(" ") as script>
<script defer src="${url.resourcesPath}/${script}" type="text/javascript"></script>
</#list>
</#if>
</#macro>

View file

@ -0,0 +1,6 @@
<#-- https://github.com/tailwindlabs/heroicons/blob/master/src/outline/chevron-down.svg -->
<#macro kw>
<svg fill="none" height="1em" stroke="currentColor" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
</svg>
</#macro>

View file

@ -0,0 +1,6 @@
<#-- https://github.com/tailwindlabs/heroicons/blob/master/src/outline/external-link.svg -->
<#macro kw>
<svg fill="none" height="1em" stroke="currentColor" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
</svg>
</#macro>

View file

@ -0,0 +1,23 @@
<#macro kw invalid name autofocus=false disabled=false message=true required=true rest...>
<label class="sr-only" for="${name}">
<#nested>
</label>
<input
<#if autofocus>autofocus</#if>
<#if disabled>disabled</#if>
<#if required>required</#if>
aria-invalid="${messagesPerField.existsError(invalid)?c}"
class="block border-gray-300 mt-1 rounded-md w-full focus:border-primary-300 focus:ring focus:ring-primary-200 focus:ring-opacity-50 sm:text-sm"
id="${name}"
name="${name}"
placeholder="<#compress><#nested></#compress>"
<#list rest as attrName, attrValue>
${attrName}="${attrValue}"
</#list>
>
<#if message && messagesPerField.existsError(invalid)>
<div class="mt-2 text-red-600 text-sm">
${kcSanitize(messagesPerField.getFirstError(invalid))?no_esc}
</div>
</#if>
</#macro>

View file

@ -0,0 +1,11 @@
<#macro kw>
<#compress>
<#if !realm.loginWithEmailAllowed>
${msg("username")}
<#elseif !realm.registrationEmailAsUsername>
${msg("usernameOrEmail")}
<#else>
${msg("email")}
</#if>
</#compress>
</#macro>

View file

@ -0,0 +1,18 @@
<#macro kw>
<#switch message.type>
<#case "error">
<#assign color="bg-red-100 text-red-600">
<#case "info">
<#assign color="bg-blue-100 text-blue-600">
<#case "success">
<#assign color="bg-green-100 text-green-600">
<#case "warning">
<#assign color="bg-orange-100 text-orange-600">
<#default>
<#assign color="bg-blue-100 text-blue-600">
</#switch>
<div class="${color} p-4 rounded-lg text-sm" role="alert">
<span>${kcSanitize(message.summary)?no_esc}</span>
</div>
</#macro>

View file

@ -0,0 +1,10 @@
<#import "../button/primary.ftl" as buttonPrimary>
<#macro kw>
<form action="${url.loginAction}" class="flex justify-center" method="post">
<input name="tryAnotherWay" type="hidden" value="on"/>
<@buttonPrimary.kw type="submit">
${msg("doTryAnotherWay")}
</@buttonPrimary.kw>
</form>
</#macro>

View file

@ -0,0 +1,5 @@
<#macro kw>
<footer class="space-y-4">
<#nested>
</footer>
</#macro>

View file

@ -0,0 +1,5 @@
<#macro kw>
<header class="space-y-4">
<#nested>
</header>
</#macro>

View file

@ -0,0 +1,5 @@
<#macro kw>
<main class="space-y-4">
<#nested>
</main>
</#macro>

View file

@ -0,0 +1,5 @@
<#macro kw>
<div class="bg-white p-8 rounded-lg space-y-6">
<#nested>
</div>
</#macro>

View file

@ -0,0 +1,7 @@
<#macro kw>
<div class="bg-gray-100 flex flex-col items-center justify-center min-h-screen sm:py-16">
<div class="max-w-md space-y-6 w-full">
<#nested>
</div>
</div>
</#macro>

View file

@ -0,0 +1,28 @@
<#import "../icon/chevron-down.ftl" as iconChevronDown>
<#import "../link/secondary.ftl" as linkSecondary>
<#macro kw>
<div class="relative" x-data="{open: false}">
<@linkSecondary.kw component="button" type="button" @click="open = true">
<div class="flex items-center">
<span class="mr-1 text-sm">${locale.current}</span>
<@iconChevronDown.kw />
</div>
</@linkSecondary.kw>
<div
class="absolute bg-white bottom-0 -left-4 max-h-80 mb-6 overflow-y-scroll rounded-lg shadow-lg"
x-show="open"
@click.away="open = false"
>
<#list locale.supported as locales>
<#if locale.current != locales.label>
<div class="px-4 py-2">
<@linkSecondary.kw href=locales.url>
<span class="text-sm">${locales.label}</span>
</@linkSecondary.kw>
</div>
</#if>
</#list>
</ul>
</div>
</#macro>

View file

@ -0,0 +1,5 @@
<#macro kw>
<div class="flex justify-around">
<#nested>
</div>
</#macro>

View file

@ -0,0 +1,3 @@
<#macro kw>
<div class="text-gray-600 text-sm">* ${msg("requiredFields")}</div>
</#macro>

View file

@ -0,0 +1,3 @@
<#macro kw>
<h1 class="text-center text-xl"><#nested "header"></h1>
</#macro>

View file

@ -0,0 +1,5 @@
<#macro kw>
<div class="font-bold text-center text-2xl">
${kcSanitize(msg("loginTitleHtml", (realm.displayNameHtml!"")))?no_esc}
</div>
</#macro>

View file

@ -0,0 +1,16 @@
<#import "../button/icon.ftl" as buttonIcon >
<#import "../button/primary.ftl" as buttonPrimary>
<#import "../icon/external-link.ftl" as iconExternalLink>
<#macro kw>
<#nested "show-username">
<div class="mb-4">
<div class="font-bold mb-2 text-center">${auth.attemptedUsername}</div>
<@buttonPrimary.kw component="a" href="${url.loginRestartFlowUrl}">
<@buttonIcon.kw>
<@iconExternalLink.kw />
</@buttonIcon.kw>
${msg("restartLoginTooltip")}
</@buttonPrimary.kw>
</div>
</#macro>

View file

@ -0,0 +1,10 @@
<#macro kw component="a" rest...>
<${component}
class="text-primary-600 hover:text-primary-500"
<#list rest as attrName, attrValue>
${attrName}="${attrValue}"
</#list>
>
<#nested>
</${component}>
</#macro>

View file

@ -0,0 +1,10 @@
<#macro kw component="a" rest...>
<${component}
class="text-gray-600 hover:text-black"
<#list rest as attrName, attrValue>
${attrName}="${attrValue}"
</#list>
>
<#nested>
</${component}>
</#macro>

View file

@ -0,0 +1,22 @@
<#import "./socials.ftl" as socials>
<#macro kw>
<div class="separate pt-4">${msg("identity-provider-login-label")}</div>
<div class="flex <#if social.providers?size gt 3>justify-between<#else>justify-around</#if>">
<#list social.providers as provider>
<a
class="text-5xl"
data-provider="${provider.alias}"
href="${provider.loginUrl}"
title="${provider.displayName!}"
type="button"
>
<#if provider.iconClasses?has_content>
<i class="${provider.iconClasses!}"></i>
<#else>
<@socials[provider.alias] />
</#if>
</a>
</#list>
</div>
</#macro>

View file

@ -0,0 +1,37 @@
<#-- https://facebookbrand.com/facebookapp/assets/f-logo/ -->
<#macro facebook>
<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0H24V24H0V0Z" fill="white"/>
<path d="M20 12.0972C20 7.6789 16.4183 4.09719 12 4.09719C7.58172 4.09719 4 7.6789 4 12.0972C4 16.0902 6.92548 19.3998 10.75 20V14.4097H8.71875V12.0972H10.75V10.3347C10.75 8.32969 11.9443 7.22219 13.7717 7.22219C14.647 7.22219 15.5625 7.37844 15.5625 7.37844V9.34719H14.5537C13.5599 9.34719 13.25 9.96386 13.25 10.5965V12.0972H15.4688L15.1141 14.4097H13.25V20C17.0745 19.3998 20 16.0902 20 12.0972Z" fill="#1877F2"/>
</svg>
</#macro>
<#-- https://github.com/logos -->
<#macro github>
<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0H24V24H0V0Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.999 4C7.5825 4 4 7.5675 4 11.9685C4 15.4885 6.292 18.475 9.471 19.5285C9.871 19.602 10.017 19.356 10.017 19.1445C10.017 18.956 10.01 18.4545 10.0065 17.7895C7.7815 18.271 7.3115 16.7215 7.3115 16.7215C6.9475 15.801 6.423 15.556 6.423 15.556C5.697 15.062 6.478 15.0715 6.478 15.0715C7.281 15.128 7.7035 15.893 7.7035 15.893C8.417 17.1105 9.576 16.7585 10.032 16.5545C10.1045 16.04 10.3115 15.689 10.5395 15.4895C8.7635 15.289 6.8955 14.6045 6.8955 11.5515C6.8955 10.6815 7.2075 9.97 7.719 9.4135C7.6365 9.212 7.362 8.4015 7.798 7.3045C7.798 7.3045 8.469 7.0905 9.9975 8.1215C10.6503 7.94431 11.3236 7.85403 12 7.853C12.68 7.8565 13.364 7.9445 14.003 8.1215C15.5305 7.0905 16.2005 7.305 16.2005 7.305C16.6375 8.4015 16.363 9.212 16.2805 9.4135C16.7935 9.97 17.103 10.682 17.103 11.5515C17.103 14.6125 15.232 15.2865 13.4505 15.4835C13.7375 15.7295 13.993 16.2155 13.993 16.959C13.993 18.024 13.983 18.884 13.983 19.1445C13.983 19.358 14.128 19.606 14.533 19.528C17.71 18.472 20 15.4885 20 11.9685C20 7.568 16.418 4 11.999 4Z" fill="#161514"/>
</svg>
</#macro>
<#-- https://developers.google.com/identity/branding-guidelines -->
<#macro google>
<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0H24V24H0V0Z" fill="white"/>
<path d="M19.5302 12.1776C19.5302 11.52 19.4772 11.0399 19.3627 10.5424H11.9232V13.5112H16.2903C16.2023 14.2488 15.7267 15.36 14.6701 16.1066L14.6551 16.2061L17.0079 18.0458L17.1709 18.0623C18.6671 16.6666 19.5302 14.6134 19.5302 12.1776Z" fill="#4285F4"/>
<path d="M11.9233 20C14.0626 20 15.8588 19.2889 17.1705 18.0623L14.6702 16.1065C14.0011 16.5776 13.103 16.9066 11.9233 16.9066C9.82808 16.9066 8.04986 15.5114 7.41578 13.5822L7.32277 13.5902L4.87696 15.5014L4.84496 15.5914C6.14812 18.2043 8.82445 20 11.9233 20Z" fill="#34A853"/>
<path d="M7.41593 13.5822C7.24279 13.0726 7.15362 12.5383 7.1519 12C7.1519 11.449 7.24841 10.9154 7.40693 10.4178L7.40293 10.3118L4.92612 8.37009L4.84511 8.40909C4.29002 9.52462 4.00076 10.7535 4 11.9995C4 13.2887 4.30804 14.5069 4.84511 15.591L7.41593 13.5822Z" fill="#FBBC05"/>
<path d="M11.9233 7.09339C13.411 7.09339 14.4152 7.74197 14.9872 8.28454L17.2235 6.07976C15.8498 4.7911 14.0631 4 11.9233 4C8.82445 4 6.14762 5.79522 4.84496 8.40905L7.40678 10.4178C8.04986 8.48906 9.82808 7.09339 11.9233 7.09339Z" fill="#EB4335"/>
</svg>
</#macro>
<#-- https://docs.microsoft.com/azure/active-directory/develop/howto-add-branding-in-azure-ad-apps -->
<#macro microsoft>
<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0H24V24H0V0Z" fill="white"/>
<path d="M5 5H11.6316V11.6316H5V5Z" fill="#F25022"/>
<path d="M5 12.3686H11.6316V19.0002H5V12.3686Z" fill="#00A4EF"/>
<path d="M12.3684 5H19V11.6316H12.3684V5Z" fill="#7FBA00"/>
<path d="M12.3684 12.3686H19V19.0002H12.3684V12.3686Z" fill="#FFB900"/>
</svg>
</#macro>

View file

@ -0,0 +1,42 @@
<#import "template.ftl" as layout>
<#import "components/button/primary.ftl" as buttonPrimary>
<#import "components/input/primary.ftl" as inputPrimary>
<#import "components/label/username.ftl" as labelUsername>
<#import "components/link/secondary.ftl" as linkSecondary>
<@layout.registrationLayout
displayInfo=true
displayMessage=!messagesPerField.existsError("username")
;
section
>
<#if section="header">
${msg("emailForgotTitle")}
<#elseif section="form">
<form action="${url.loginAction}" class="m-0 space-y-4" method="post">
<div>
<@inputPrimary.kw
autocomplete=realm.loginWithEmailAllowed?string("email", "username")
autofocus=true
invalid=["username"]
name="username"
type=realm.loginWithEmailAllowed?string("email", "text")
value=(auth?has_content && auth.showUsername())?then(auth.attemptedUsername, '')
>
<@labelUsername.kw />
</@inputPrimary.kw>
</div>
<div>
<@buttonPrimary.kw type="submit">
${msg("doSubmit")}
</@buttonPrimary.kw>
</div>
</form>
<#elseif section="info">
${msg("emailInstruction")}
<#elseif section="nav">
<@linkSecondary.kw href=url.loginUrl>
<span class="text-sm">${kcSanitize(msg("backToLogin"))?no_esc}</span>
</@linkSecondary.kw>
</#if>
</@layout.registrationLayout>

View file

@ -0,0 +1,85 @@
<#import "template.ftl" as layout>
<#import "components/provider.ftl" as provider>
<#import "components/button/primary.ftl" as buttonPrimary>
<#import "components/checkbox/primary.ftl" as checkboxPrimary>
<#import "components/input/primary.ftl" as inputPrimary>
<#import "components/label/username.ftl" as labelUsername>
<#import "components/link/primary.ftl" as linkPrimary>
<@layout.registrationLayout
displayInfo=realm.password && realm.registrationAllowed && !registrationDisabled??
displayMessage=!messagesPerField.existsError("username", "password")
;
section
>
<#if section="header">
${msg("loginAccountTitle")}
<#elseif section="form">
<#if realm.password>
<form
action="${url.loginAction}"
class="m-0 space-y-4"
method="post"
onsubmit="login.disabled = true; return true;"
>
<input
name="credentialId"
type="hidden"
value="<#if auth.selectedCredential?has_content>${auth.selectedCredential}</#if>"
>
<div>
<@inputPrimary.kw
autocomplete=realm.loginWithEmailAllowed?string("email", "username")
autofocus=true
disabled=usernameEditDisabled??
invalid=["username", "password"]
name="username"
type=realm.loginWithEmailAllowed?string("email", "text")
value=(login.username)!''
>
<@labelUsername.kw />
</@inputPrimary.kw>
</div>
<div>
<@inputPrimary.kw
invalid=["username", "password"]
message=false
name="password"
type="password"
>
${msg("password")}
</@inputPrimary.kw>
</div>
<div class="flex items-center justify-between">
<#if realm.rememberMe && !usernameEditDisabled??>
<@checkboxPrimary.kw checked=login.rememberMe?? name="rememberMe">
${msg("rememberMe")}
</@checkboxPrimary.kw>
</#if>
<#if realm.resetPasswordAllowed>
<@linkPrimary.kw href=url.loginResetCredentialsUrl>
<span class="text-sm">${msg("doForgotPassword")}</span>
</@linkPrimary.kw>
</#if>
</div>
<div class="pt-4">
<@buttonPrimary.kw name="login" type="submit">
${msg("doLogIn")}
</@buttonPrimary.kw>
</div>
</form>
</#if>
<#if realm.password && social.providers??>
<@provider.kw />
</#if>
<#elseif section="info">
<#if realm.password && realm.registrationAllowed && !registrationDisabled??>
<div class="text-center">
${msg("noAccount")}
<@linkPrimary.kw href=url.registrationUrl>
${msg("doRegister")}
</@linkPrimary.kw>
</div>
</#if>
</#if>
</@layout.registrationLayout>

View file

@ -0,0 +1,101 @@
<#import "template.ftl" as layout>
<#import "components/button/primary.ftl" as buttonPrimary>
<#import "components/input/primary.ftl" as inputPrimary>
<#import "components/link/secondary.ftl" as linkSecondary>
<@layout.registrationLayout
displayMessage=!messagesPerField.existsError("firstName", "lastName", "email", "username", "password", "password-confirm")
;
section
>
<#if section="header">
${msg("registerTitle")}
<#elseif section="form">
<form action="${url.registrationAction}" class="m-0 space-y-4" method="post">
<div>
<@inputPrimary.kw
autocomplete="given-name"
autofocus=true
invalid=["firstName"]
name="firstName"
type="text"
value=(register.formData.firstName)!''
>
${msg("firstName")}
</@inputPrimary.kw>
</div>
<div>
<@inputPrimary.kw
autocomplete="family-name"
invalid=["lastName"]
name="lastName"
type="text"
value=(register.formData.lastName)!''
>
${msg("lastName")}
</@inputPrimary.kw>
</div>
<div>
<@inputPrimary.kw
autocomplete="email"
invalid=["email"]
name="email"
type="email"
value=(register.formData.email)!''
>
${msg("email")}
</@inputPrimary.kw>
</div>
<#if !realm.registrationEmailAsUsername>
<div>
<@inputPrimary.kw
autocomplete="username"
invalid=["username"]
name="username"
type="text"
value=(register.formData.username)!''
>
${msg("username")}
</@inputPrimary.kw>
</div>
</#if>
<#if passwordRequired??>
<div>
<@inputPrimary.kw
autocomplete="new-password"
invalid=["password", "password-confirm"]
message=false
name="password"
type="password"
>
${msg("password")}
</@inputPrimary.kw>
</div>
<div>
<@inputPrimary.kw
autocomplete="new-password"
invalid=["password-confirm"]
name="password-confirm"
type="password"
>
${msg("passwordConfirm")}
</@inputPrimary.kw>
</div>
</#if>
<#if recaptchaRequired??>
<div>
<div class="g-recaptcha" data-sitekey="${recaptchaSiteKey}" data-size="compact"></div>
</div>
</#if>
<div>
<@buttonPrimary.kw type="submit">
${msg("doRegister")}
</@buttonPrimary.kw>
</div>
</form>
<#elseif section="nav">
<@linkSecondary.kw href=url.loginUrl>
<span class="text-sm">${kcSanitize(msg("backToLogin"))?no_esc}</span>
</@linkSecondary.kw>
</#if>
</@layout.registrationLayout>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,67 @@
<#import "components/document.ftl" as document>
<#import "components/layout/alerts.ftl" as alerts>
<#import "components/layout/another-way.ftl" as anotherWay>
<#import "components/layout/card.ftl" as card>
<#import "components/layout/card-footer.ftl" as cardFooter>
<#import "components/layout/card-header.ftl" as cardHeader>
<#import "components/layout/card-main.ftl" as cardMain>
<#import "components/layout/container.ftl" as container>
<#import "components/layout/locales.ftl" as locales>
<#import "components/layout/nav.ftl" as nav>
<#import "components/layout/required-fields.ftl" as requiredFields>
<#import "components/layout/title.ftl" as title>
<#import "components/layout/subtitle.ftl" as subtitle>
<#import "components/layout/username.ftl" as username>
<#macro
registrationLayout
displayInfo=false
displayMessage=true
displayRequiredFields=false
showAnotherWayIfPresent=true
>
<html>
<head>
<@document.kw />
</head>
<body>
<@container.kw>
<@card.kw>
<@cardHeader.kw>
<@title.kw />
<#if !(auth?has_content && auth.showUsername() && !auth.showResetCredentials())>
<@subtitle.kw>
<#nested "header">
</@subtitle.kw>
<#else>
<@username.kw />
</#if>
</@cardHeader.kw>
<@cardMain.kw>
<#if displayMessage && message?has_content && (message.type != "warning" || !isAppInitiatedAction??)>
<@alerts.kw />
</#if>
<#nested "form">
<#if displayRequiredFields>
<@requiredFields.kw />
</#if>
<#if auth?has_content && auth.showTryAnotherWayLink() && showAnotherWayIfPresent>
<@anotherWay.kw />
</#if>
</@cardMain.kw>
<#if displayInfo>
<@cardFooter.kw>
<#nested "info">
</@cardFooter.kw>
</#if>
</@card.kw>
<@nav.kw>
<#nested "nav">
<#if realm.internationalizationEnabled && locale.supported?size gt 1>
<@locales.kw />
</#if>
</@nav.kw>
</@container.kw>
</body>
</html>
</#macro>

View file

@ -0,0 +1,4 @@
parent=base
styles=dist/index.css
scripts=dist/index.js

2612
yarn.lock Normal file

File diff suppressed because it is too large Load diff