登录页自定义
ci / test (push) Failing after 24s
ci / Check if version upgrade (push) Skipped
ci / create_github_release (push) Skipped

This commit is contained in:
2026-08-03 09:22:37 +08:00 Unverified
parent 869e2e61ec
commit a9129bab60
3 changed files with 921 additions and 3 deletions
+41 -3
View File
@@ -3,7 +3,8 @@ import type { ClassKey } from "keycloakify/login";
import type { KcContext } from "./KcContext"; import type { KcContext } from "./KcContext";
import { useI18n } from "./i18n"; import { useI18n } from "./i18n";
import DefaultPage from "keycloakify/login/DefaultPage"; import DefaultPage from "keycloakify/login/DefaultPage";
import Template from "keycloakify/login/Template"; import Template from "./Template";
import "./theme.css";
const UserProfileFormFields = lazy( const UserProfileFormFields = lazy(
() => import("keycloakify/login/UserProfileFormFields") () => import("keycloakify/login/UserProfileFormFields")
); );
@@ -26,7 +27,7 @@ export default function KcPage(props: { kcContext: KcContext }) {
i18n={i18n} i18n={i18n}
classes={classes} classes={classes}
Template={Template} Template={Template}
doUseDefaultCss={true} doUseDefaultCss={false}
UserProfileFormFields={UserProfileFormFields} UserProfileFormFields={UserProfileFormFields}
doMakeUserConfirmPassword={doMakeUserConfirmPassword} doMakeUserConfirmPassword={doMakeUserConfirmPassword}
/> />
@@ -37,4 +38,41 @@ export default function KcPage(props: { kcContext: KcContext }) {
); );
} }
const classes = {} satisfies { [key in ClassKey]?: string }; const classes = {
kcBodyClass: "nexus-body",
kcLoginClass: "nexus-login",
kcHeaderClass: "nexus-header",
kcHeaderWrapperClass: "nexus-header__name",
kcFormCardClass: "nexus-card",
kcFormHeaderClass: "nexus-card__header",
kcFormGroupClass: "nexus-field",
kcLabelClass: "nexus-label",
kcInputClass: "nexus-input",
kcInputGroup: "nexus-input-group",
kcFormSettingClass: "nexus-form-settings",
kcFormOptionsWrapperClass: "nexus-form-options",
kcFormPasswordVisibilityButtonClass: "nexus-password-toggle",
kcButtonClass: "nexus-button",
kcButtonBlockClass: "nexus-button--block",
kcButtonLargeClass: "nexus-button--large",
kcButtonPrimaryClass: "nexus-button--primary",
kcButtonSecondaryClass: "nexus-button--secondary",
kcButtonDefaultClass: "nexus-button--default",
kcAlertClass: "nexus-alert",
kcFeedbackErrorIcon: "nexus-feedback nexus-feedback--error",
kcFeedbackWarningIcon: "nexus-feedback nexus-feedback--warning",
kcFeedbackSuccessIcon: "nexus-feedback nexus-feedback--success",
kcFeedbackInfoIcon: "nexus-feedback nexus-feedback--info",
kcFormSocialAccountSectionClass: "nexus-social",
kcFormSocialAccountListClass: "nexus-social__list",
kcFormSocialAccountListButtonClass: "nexus-social__button",
kcFormSocialAccountNameClass: "nexus-social__name",
kcSignUpClass: "nexus-signup",
kcInfoAreaWrapperClass: "nexus-signup__inner",
kcLocaleMainClass: "nexus-locale",
kcLocaleDropDownClass: "nexus-locale__dropdown",
kcLocaleListClass: "nexus-locale__list",
kcLocaleListItemClass: "nexus-locale__list-item",
kcLocaleItemClass: "nexus-locale__item",
kcInputErrorMessageClass: "nexus-field__error"
} satisfies { [key in ClassKey]?: string };
+43
View File
@@ -0,0 +1,43 @@
import BaseTemplate from "keycloakify/login/Template";
import type { TemplateProps } from "keycloakify/login/TemplateProps";
import type { KcContext } from "./KcContext";
import type { I18n } from "./i18n";
export default function Template(props: TemplateProps<KcContext, I18n>) {
return (
<>
<div className="nexus-atmosphere" aria-hidden="true">
<div className="nexus-grid" />
<div className="nexus-orbit nexus-orbit--outer">
<span className="nexus-orbit__node" />
</div>
<div className="nexus-orbit nexus-orbit--inner">
<span className="nexus-orbit__node" />
</div>
<div className="nexus-core">
<span>N</span>
</div>
</div>
<aside className="nexus-manifesto" aria-hidden="true">
<div className="nexus-wordmark">
<span className="nexus-wordmark__signal" />
NEXUS <b>/ ID</b>
</div>
<div className="nexus-manifesto__copy">
<p>IDENTITY ACCESS LAYER</p>
<h2>
Secure access.
<span>Precisely orchestrated.</span>
</h2>
</div>
<div className="nexus-system-status">
<span>SECURE CHANNEL</span>
<span className="nexus-system-status__state">SYSTEM ONLINE</span>
</div>
</aside>
<BaseTemplate {...props} />
</>
);
}
+837
View File
@@ -0,0 +1,837 @@
:root {
--nexus-void: #050713;
--nexus-panel: #0c1020;
--nexus-panel-soft: #11172b;
--nexus-ice: #63e6ff;
--nexus-violet: #8b7cff;
--nexus-text: #f4f7ff;
--nexus-muted: #8e9ab7;
--nexus-line: rgba(149, 170, 222, 0.18);
--nexus-danger: #ff668f;
--nexus-success: #54e6a4;
--nexus-display: "Bahnschrift SemiCondensed", "Arial Narrow", sans-serif;
--nexus-body-font: "Segoe UI Variable", "Segoe UI", sans-serif;
--nexus-mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}
* {
box-sizing: border-box;
}
html.login-pf {
min-height: 100%;
background: var(--nexus-void);
}
body.nexus-body {
min-height: 100vh;
margin: 0;
overflow-x: hidden;
color: var(--nexus-text);
background: radial-gradient(
circle at 18% 24%,
rgba(99, 230, 255, 0.08),
transparent 27rem
),
radial-gradient(circle at 84% 82%, rgba(139, 124, 255, 0.09), transparent 32rem),
var(--nexus-void);
font-family: var(--nexus-body-font);
font-size: 15px;
line-height: 1.5;
}
.nexus-body button,
.nexus-body input,
.nexus-body select,
.nexus-body textarea {
font: inherit;
}
.nexus-atmosphere {
position: fixed;
inset: 0;
z-index: 0;
overflow: hidden;
pointer-events: none;
}
.nexus-grid {
position: absolute;
inset: 0;
opacity: 0.32;
background-image: linear-gradient(rgba(127, 155, 207, 0.055) 1px, transparent 1px),
linear-gradient(90deg, rgba(127, 155, 207, 0.055) 1px, transparent 1px);
background-size: 52px 52px;
mask-image: linear-gradient(
to right,
black 0%,
rgba(0, 0, 0, 0.8) 48%,
transparent 78%
);
}
.nexus-grid::after {
position: absolute;
inset: 0;
content: "";
background: linear-gradient(
110deg,
transparent 18%,
rgba(99, 230, 255, 0.035) 49.8%,
rgba(99, 230, 255, 0.2) 50%,
rgba(99, 230, 255, 0.035) 50.2%,
transparent 82%
);
transform: translateX(-70%);
animation: nexus-scan 9s ease-in-out infinite;
}
.nexus-orbit {
position: absolute;
left: 9vw;
top: 50%;
width: min(43vw, 680px);
aspect-ratio: 1;
border: 1px solid rgba(99, 230, 255, 0.17);
border-radius: 50%;
transform: translateY(-50%) rotate(-18deg);
}
.nexus-orbit::before,
.nexus-orbit::after {
position: absolute;
content: "";
border-radius: inherit;
}
.nexus-orbit::before {
inset: 11%;
border: 1px dashed rgba(139, 124, 255, 0.22);
}
.nexus-orbit::after {
inset: 25%;
border: 1px solid rgba(99, 230, 255, 0.09);
}
.nexus-orbit--inner {
width: min(30vw, 470px);
left: 15.5vw;
border-color: rgba(139, 124, 255, 0.24);
transform: translateY(-50%) rotate(31deg);
}
.nexus-orbit__node {
position: absolute;
top: 48%;
left: -5px;
width: 9px;
height: 9px;
border: 2px solid var(--nexus-void);
border-radius: 50%;
background: var(--nexus-ice);
box-shadow:
0 0 0 5px rgba(99, 230, 255, 0.1),
0 0 22px var(--nexus-ice);
animation: nexus-pulse 2.8s ease-in-out infinite;
}
.nexus-orbit--inner .nexus-orbit__node {
top: auto;
right: 14%;
bottom: 5%;
left: auto;
background: var(--nexus-violet);
box-shadow:
0 0 0 5px rgba(139, 124, 255, 0.12),
0 0 22px var(--nexus-violet);
animation-delay: -1.4s;
}
.nexus-core {
position: absolute;
left: calc(9vw + min(21.5vw, 340px));
top: 50%;
display: grid;
width: 92px;
height: 92px;
place-items: center;
border: 1px solid rgba(99, 230, 255, 0.35);
color: var(--nexus-text);
background: rgba(8, 13, 29, 0.74);
box-shadow:
inset 0 0 30px rgba(99, 230, 255, 0.09),
0 0 70px rgba(99, 230, 255, 0.13);
font-family: var(--nexus-display);
font-size: 2rem;
transform: translate(-50%, -50%) rotate(45deg);
backdrop-filter: blur(8px);
}
.nexus-core span {
transform: rotate(-45deg);
}
.nexus-manifesto {
position: fixed;
inset: 0 50% 0 0;
z-index: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: clamp(36px, 5vw, 76px);
pointer-events: none;
}
.nexus-wordmark {
display: flex;
align-items: center;
gap: 11px;
font-family: var(--nexus-display);
font-size: 0.92rem;
font-weight: 600;
letter-spacing: 0.2em;
}
.nexus-wordmark b {
color: var(--nexus-muted);
font-weight: 400;
}
.nexus-wordmark__signal {
width: 8px;
height: 8px;
background: var(--nexus-ice);
box-shadow: 0 0 16px var(--nexus-ice);
transform: rotate(45deg);
}
.nexus-manifesto__copy {
max-width: 620px;
margin-bottom: 9vh;
}
.nexus-manifesto__copy p,
.nexus-system-status {
color: var(--nexus-muted);
font-family: var(--nexus-mono);
font-size: 0.66rem;
letter-spacing: 0.18em;
}
.nexus-manifesto__copy p::before {
content: "[ ";
color: var(--nexus-ice);
}
.nexus-manifesto__copy p::after {
content: " ]";
color: var(--nexus-ice);
}
.nexus-manifesto__copy h2 {
margin: 18px 0 0;
font-family: var(--nexus-display);
font-size: clamp(2.8rem, 4.6vw, 5.8rem);
font-stretch: condensed;
font-weight: 460;
letter-spacing: -0.055em;
line-height: 0.91;
}
.nexus-manifesto__copy h2 span {
display: block;
color: transparent;
background: linear-gradient(
100deg,
var(--nexus-ice),
#c3caff 62%,
var(--nexus-violet)
);
background-clip: text;
-webkit-background-clip: text;
}
.nexus-system-status {
display: flex;
justify-content: space-between;
width: min(33vw, 470px);
padding-top: 16px;
border-top: 1px solid var(--nexus-line);
}
.nexus-system-status__state {
color: var(--nexus-success);
}
.nexus-system-status__state::before {
display: inline-block;
width: 5px;
height: 5px;
margin: 0 8px 1px 0;
border-radius: 50%;
background: currentColor;
box-shadow: 0 0 9px currentColor;
content: "";
}
.nexus-login {
position: relative;
z-index: 2;
display: flex;
min-height: 100vh;
flex-direction: column;
justify-content: center;
width: 50%;
margin-left: 50%;
padding: clamp(28px, 6vw, 96px);
}
.nexus-header {
width: min(100%, 480px);
margin: 0 auto 14px;
padding: 0;
text-align: left;
}
.nexus-header__name#kc-header-wrapper {
padding: 0;
color: var(--nexus-muted);
background: none;
font-family: var(--nexus-mono);
font-size: 0.7rem;
font-weight: 500;
letter-spacing: 0.16em;
line-height: 1.4;
text-transform: uppercase;
}
.nexus-header__name#kc-header-wrapper::before {
content: "REALM / ";
color: var(--nexus-ice);
}
.nexus-card {
position: relative;
width: min(100%, 480px);
margin: 0 auto;
padding: clamp(32px, 4vw, 54px);
border: 1px solid var(--nexus-line);
border-radius: 3px;
color: var(--nexus-text);
background: linear-gradient(145deg, rgba(18, 24, 45, 0.94), rgba(9, 13, 28, 0.9));
box-shadow:
0 28px 80px rgba(0, 0, 0, 0.38),
inset 0 1px rgba(255, 255, 255, 0.035);
backdrop-filter: blur(22px);
}
.nexus-card::before,
.nexus-card::after {
position: absolute;
width: 28px;
height: 28px;
border-color: var(--nexus-ice);
opacity: 0.8;
content: "";
pointer-events: none;
}
.nexus-card::before {
top: -1px;
left: -1px;
border-top: 1px solid;
border-left: 1px solid;
}
.nexus-card::after {
right: -1px;
bottom: -1px;
border-right: 1px solid;
border-bottom: 1px solid;
}
.nexus-card__header {
margin-bottom: 30px;
}
.nexus-card__header #kc-page-title {
margin: 0;
color: var(--nexus-text);
font-family: var(--nexus-display);
font-size: clamp(2rem, 3vw, 2.65rem);
font-weight: 520;
letter-spacing: -0.035em;
line-height: 1.05;
text-align: left;
}
.nexus-card__header #kc-page-title::after {
display: block;
width: 46px;
height: 2px;
margin-top: 17px;
background: linear-gradient(90deg, var(--nexus-ice), var(--nexus-violet));
box-shadow: 0 0 16px rgba(99, 230, 255, 0.45);
content: "";
}
.nexus-card a {
color: #a9eefe;
text-decoration: none;
transition: color 160ms ease;
}
.nexus-card a:hover {
color: #ffffff;
text-decoration: none;
}
.nexus-field {
margin: 0 0 22px;
}
.nexus-label {
display: inline-block;
margin-bottom: 9px;
color: #b7c2dc;
font-size: 0.78rem;
font-weight: 600;
letter-spacing: 0.045em;
}
.nexus-input,
.nexus-card textarea.form-control,
.nexus-card select.form-control {
width: 100%;
height: 48px;
padding: 0 15px;
border: 1px solid rgba(151, 172, 219, 0.24);
border-radius: 2px;
color: var(--nexus-text);
outline: 0;
background: rgba(4, 8, 21, 0.7);
box-shadow: none;
font-family: var(--nexus-body-font);
font-size: 0.95rem;
transition:
border-color 160ms ease,
box-shadow 160ms ease,
background 160ms ease;
}
.nexus-input:hover {
border-color: rgba(151, 172, 219, 0.44);
}
.nexus-input:focus,
.nexus-card textarea.form-control:focus,
.nexus-card select.form-control:focus {
border-color: var(--nexus-ice);
background: rgba(7, 12, 28, 0.92);
box-shadow:
0 0 0 3px rgba(99, 230, 255, 0.09),
0 0 22px rgba(99, 230, 255, 0.08);
}
.nexus-input[aria-invalid="true"] {
border-color: var(--nexus-danger);
}
.nexus-input-group {
display: flex;
}
.nexus-input-group .nexus-input {
border-radius: 2px 0 0 2px;
}
.nexus-input-group .pf-c-button.pf-m-control {
width: 48px;
min-width: 48px;
border: 1px solid rgba(151, 172, 219, 0.24);
border-left: 0;
border-radius: 0 2px 2px 0;
color: var(--nexus-muted);
background: rgba(4, 8, 21, 0.7);
}
.nexus-field__error {
display: block;
margin-top: 8px;
color: #ff93ae;
font-size: 0.78rem;
}
.nexus-form-settings.nexus-field {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin: -2px 0 26px;
color: var(--nexus-muted);
font-size: 0.78rem;
}
.nexus-form-settings.nexus-field #kc-form-options,
.nexus-form-settings.nexus-field > div {
width: auto;
}
.nexus-form-settings input[type="checkbox"] {
width: 14px;
height: 14px;
margin: 0 7px 0 0;
accent-color: var(--nexus-ice);
vertical-align: -2px;
}
.nexus-button {
position: relative;
min-height: 48px;
border: 1px solid rgba(151, 172, 219, 0.25);
border-radius: 2px;
color: var(--nexus-text);
background: rgba(18, 25, 47, 0.86);
box-shadow: none;
font-family: var(--nexus-body-font);
font-size: 0.84rem;
font-weight: 650;
letter-spacing: 0.055em;
transition:
transform 160ms ease,
border-color 160ms ease,
box-shadow 160ms ease,
filter 160ms ease;
}
.nexus-button--primary {
border: 0;
color: #05101b;
background: linear-gradient(105deg, #63e6ff 0%, #8cf0ec 48%, #a8a1ff 100%);
box-shadow: 0 9px 28px rgba(99, 230, 255, 0.15);
}
.nexus-button--block {
display: block;
width: 100%;
}
.nexus-button:hover:not(:disabled) {
border-color: rgba(99, 230, 255, 0.65);
filter: brightness(1.08);
transform: translateY(-1px);
}
.nexus-button:focus-visible,
.nexus-card a:focus-visible,
.nexus-card button:focus-visible,
.nexus-card input:focus-visible {
outline: 2px solid var(--nexus-ice);
outline-offset: 3px;
}
.nexus-button:disabled {
cursor: wait;
filter: saturate(0.35);
opacity: 0.65;
}
.nexus-password-toggle {
display: grid;
width: 48px;
min-width: 48px;
place-items: center;
border: 1px solid rgba(151, 172, 219, 0.24);
border-left: 0;
border-radius: 0 2px 2px 0;
color: var(--nexus-muted);
background: rgba(4, 8, 21, 0.7);
cursor: pointer;
}
.nexus-password-toggle i::before {
content: "\25C9";
font-size: 0.85rem;
}
.nexus-alert {
display: flex;
gap: 10px;
margin: 0 0 24px;
padding: 13px 14px;
border: 1px solid var(--nexus-line);
border-radius: 2px;
color: var(--nexus-text);
background: rgba(99, 230, 255, 0.06);
font-size: 0.82rem;
}
.nexus-alert.pf-m-danger {
border-color: rgba(255, 102, 143, 0.3);
background: rgba(255, 102, 143, 0.07);
}
.nexus-alert.pf-m-success {
border-color: rgba(84, 230, 164, 0.3);
background: rgba(84, 230, 164, 0.07);
}
.nexus-feedback {
display: inline-block;
width: 8px;
height: 8px;
margin-top: 6px;
border-radius: 50%;
background: var(--nexus-ice);
box-shadow: 0 0 9px currentColor;
}
.nexus-feedback--error,
.nexus-feedback--warning {
color: var(--nexus-danger);
background: currentColor;
}
.nexus-feedback--success {
color: var(--nexus-success);
background: currentColor;
}
.nexus-social {
margin-top: 30px;
}
.nexus-social hr {
height: 1px;
margin: 0 0 24px;
border: 0;
background: var(--nexus-line);
}
.nexus-social h2 {
margin: 0 0 13px;
color: var(--nexus-muted);
font-family: var(--nexus-mono);
font-size: 0.64rem;
font-weight: 500;
letter-spacing: 0.12em;
text-align: left;
text-transform: uppercase;
}
.nexus-social__list,
.nexus-social__list.pf-l-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 9px;
margin: 0;
padding: 0;
list-style: none;
}
.nexus-social__list li,
.nexus-social__list .pf-l-grid__item {
width: auto;
max-width: none;
}
.nexus-social__button {
display: flex;
min-height: 42px;
align-items: center;
gap: 10px;
justify-content: flex-start;
padding: 0 13px;
border: 1px solid var(--nexus-line);
border-radius: 2px;
color: #c7d0e6;
background: rgba(5, 9, 21, 0.46);
font-size: 0.78rem;
}
.nexus-signup {
margin: 28px 0 0;
color: var(--nexus-muted);
font-size: 0.82rem;
}
.nexus-signup__inner {
padding: 0;
border: 0;
background: transparent;
}
.nexus-locale {
position: absolute;
top: 18px;
right: 18px;
}
.nexus-locale #kc-current-locale-link {
padding: 7px 10px;
border: 1px solid var(--nexus-line);
border-radius: 2px;
color: var(--nexus-muted);
background: rgba(6, 10, 23, 0.8);
font-family: var(--nexus-mono);
font-size: 0.68rem;
}
.nexus-locale__list {
right: 0;
left: auto;
min-width: 150px;
border: 1px solid var(--nexus-line);
color: var(--nexus-text);
background: var(--nexus-panel-soft);
}
.nexus-locale__list:not([hidden]) {
position: absolute;
z-index: 10;
top: calc(100% + 6px);
display: none;
margin: 0;
padding: 6px;
list-style: none;
}
.nexus-locale__dropdown:hover .nexus-locale__list,
.nexus-locale__dropdown:focus-within .nexus-locale__list {
display: block;
}
.nexus-locale__item {
display: block;
padding: 8px 10px;
}
.nexus-locale__item {
color: var(--nexus-text);
}
#kc-username {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 14px;
border: 1px solid var(--nexus-line);
border-radius: 2px;
background: rgba(5, 9, 21, 0.55);
}
.select-auth-container,
.pf-c-tile,
.kc-recovery-codes-list {
color: var(--nexus-text);
}
.select-auth-box-parent,
.pf-c-tile {
border-color: var(--nexus-line);
background: rgba(5, 9, 21, 0.55);
}
@keyframes nexus-scan {
0%,
20% {
transform: translateX(-70%);
}
70%,
100% {
transform: translateX(70%);
}
}
@keyframes nexus-pulse {
0%,
100% {
opacity: 0.55;
transform: scale(0.82);
}
50% {
opacity: 1;
transform: scale(1.1);
}
}
@media (max-width: 960px) {
.nexus-manifesto {
display: none;
}
.nexus-orbit {
left: 50%;
width: min(88vw, 660px);
opacity: 0.45;
transform: translate(-50%, -50%) rotate(-18deg);
}
.nexus-orbit--inner {
width: min(63vw, 470px);
transform: translate(-50%, -50%) rotate(31deg);
}
.nexus-core {
left: 50%;
opacity: 0.5;
}
.nexus-grid {
mask-image: radial-gradient(circle at center, black, transparent 72%);
}
.nexus-login {
width: 100%;
margin-left: 0;
padding: 42px 24px;
}
}
@media (max-width: 560px) {
.nexus-login {
justify-content: flex-start;
padding: 28px 16px;
}
.nexus-header {
margin-top: 8px;
}
.nexus-card {
padding: 30px 23px;
background: rgba(10, 15, 31, 0.94);
}
.nexus-card__header #kc-page-title {
font-size: 2rem;
}
.nexus-social__list,
.nexus-social__list.pf-l-grid {
grid-template-columns: 1fr;
}
.nexus-form-settings.nexus-field {
align-items: flex-start;
flex-direction: column;
gap: 10px;
}
.nexus-core {
width: 70px;
height: 70px;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}