feat: run on a single port (#3163)

* start v2

* start

* run

* some cleanup

* remove v2 pkg again

* simplify

* webauthn

* remove unused config

* fix login path in Dockerfile

* fix asset_generator.go

* health handler

* fix grpc web

* refactor

* merge

* build new main.go

* run new main.go

* update logging pkg

* fix error msg

* update logging

* cleanup

* cleanup

* go mod tidy

* change localDevMode

* fix customEndpoints

* update logging

* comments

* change local flag to external configs

* fix location generated go code

* fix

Co-authored-by: fforootd <[email protected]>
This commit is contained in:
Livio Amstutz
2022-02-14 17:22:30 +01:00
committed by GitHub
co-authored by fforootd
parent 2f3a482ade
commit 389eb4a27a
306 changed files with 1708 additions and 1567 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+93
View File
@@ -0,0 +1,93 @@
Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic ([email protected]) with Reserved Font Name "Lato"
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,57 @@
@font-face {
font-family: 'lgn-icons';
src: url('../fonts/lgn-icons.eot?p68sys');
src: url('../fonts/lgn-icons.eot?p68sys#iefix') format('embedded-opentype'),
url('../fonts/lgn-icons.ttf?p68sys') format('truetype'),
url('../fonts/lgn-icons.woff?p68sys') format('woff'),
url('../fonts/lgn-icons.svg?p68sys#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
[class^="lgn-icon-"], [class*=" lgn-icon-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'lgn-icons' !important;
speak: never;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.lgn-icon-check-solid:before {
content: "\e909";
}
.lgn-icon-times-solid:before {
content: "\e900";
}
.lgn-icon-user-plus-solid:before {
content: "\e901";
}
.lgn-icon-angle-left-solid:before {
content: "\e902";
}
.lgn-icon-angle-right-solid:before {
content: "\e903";
}
.lgn-icon-arrow-left-solid:before {
content: "\e904";
}
.lgn-icon-arrow-right-solid:before {
content: "\e905";
}
.lgn-icon-clipboard-check-solid:before {
content: "\e906";
}
.lgn-icon-clipboard:before {
content: "\e907";
}
.lgn-icon-exclamation-circle-solid:before {
content: "\e908";
}
@@ -0,0 +1,20 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="icomoon" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xe900;" glyph-name="times-solid" d="M231 775l-46-46 281-281-281-281 46-46 281 281 281-281 46 46-281 281 281 281-46 46-281-281z" />
<glyph unicode="&#xe901;" glyph-name="user-plus-solid" d="M384 896c-123.375 0-224-100.625-224-224 0-77.125 39.375-145.625 99-186-114.125-49-195-162.25-195-294h64c0 141.75 114.25 256 256 256 44 0 85-11.5 121-31-35.5-44-57-100.25-57-161 0-141 115-256 256-256s256 115 256 256c0 141-115 256-256 256-55.875 0-107.875-18.375-150-49-14.125 8.875-29.5 16.375-45 23 59.625 40.375 99 108.875 99 186 0 123.375-100.625 224-224 224zM384 832c88.75 0 160-71.25 160-160s-71.25-160-160-160c-88.75 0-160 71.25-160 160s71.25 160 160 160zM704 448c106.375 0 192-85.625 192-192s-85.625-192-192-192c-106.375 0-192 85.625-192 192s85.625 192 192 192zM672 384v-96h-96v-64h96v-96h64v96h96v64h-96v96z" />
<glyph unicode="&#xe902;" glyph-name="angle-left-solid" d="M609 823l-352-352-22-23 22-23 352-352 46 46-329 329 329 329z" />
<glyph unicode="&#xe903;" glyph-name="angle-right-solid" d="M415 823l-46-46 329-329-329-329 46-46 352 352 22 23-22 23z" />
<glyph unicode="&#xe904;" glyph-name="arrow-left-solid" d="M425 743l-272-272-22-23 22-23 272-272 46 46-217 217h642v64h-642l217 217z" />
<glyph unicode="&#xe905;" glyph-name="arrow-right-solid" d="M599 743l-46-46 217-217h-642v-64h642l-217-217 46-46 272 272 22 23-22 23z" />
<glyph unicode="&#xe906;" glyph-name="clipboard-check-solid" d="M512 896c-40.25 0-68.875-28.5-83-64h-269v-800h704v800h-269c-14.125 35.5-42.75 64-83 64zM512 832c17.75 0 32-14.25 32-32v-32h96v-64h-256v64h96v32c0 17.75 14.25 32 32 32zM224 768h96v-128h384v128h96v-672h-576zM681 535l-201-201-105 105-46-46 128-128 23-22 23 22 224 224z" />
<glyph unicode="&#xe907;" glyph-name="clipboard" d="M512 864c-40.25 0-68.875-28.5-83-64h-237v-736h640v736h-237c-14.125 35.5-42.75 64-83 64zM512 800c17.75 0 32-14.25 32-32v-32h96v-64h-256v64h96v32c0 17.75 14.25 32 32 32zM256 736h64v-128h384v128h64v-608h-512z" />
<glyph unicode="&#xe908;" glyph-name="exclamation-circle-solid" d="M512 832c-211.75 0-384-172.25-384-384s172.25-384 384-384c211.75 0 384 172.25 384 384s-172.25 384-384 384zM512 768c177.125 0 320-142.875 320-320s-142.875-320-320-320c-177.125 0-320 142.875-320 320s142.875 320 320 320zM480 640v-256h64v256zM480 320v-64h64v64z" />
<glyph unicode="&#xe909;" glyph-name="check-solid" d="M905 759l-553-553-233 233-46-46 256-256 23-22 23 22 576 576z" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 19.03125 4.28125 L 8.03125 15.28125 L 7.34375 16 L 8.03125 16.71875 L 19.03125 27.71875 L 20.46875 26.28125 L 10.1875 16 L 20.46875 5.71875 Z"/></svg>

After

Width:  |  Height:  |  Size: 221 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 12.96875 4.28125 L 11.53125 5.71875 L 21.8125 16 L 11.53125 26.28125 L 12.96875 27.71875 L 23.96875 16.71875 L 24.65625 16 L 23.96875 15.28125 Z"/></svg>

After

Width:  |  Height:  |  Size: 224 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 13.28125 6.78125 L 4.78125 15.28125 L 4.09375 16 L 4.78125 16.71875 L 13.28125 25.21875 L 14.71875 23.78125 L 7.9375 17 L 28 17 L 28 15 L 7.9375 15 L 14.71875 8.21875 Z"/></svg>

After

Width:  |  Height:  |  Size: 248 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 18.71875 6.78125 L 17.28125 8.21875 L 24.0625 15 L 4 15 L 4 17 L 24.0625 17 L 17.28125 23.78125 L 18.71875 25.21875 L 27.21875 16.71875 L 27.90625 16 L 27.21875 15.28125 Z"/></svg>

After

Width:  |  Height:  |  Size: 251 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 28.28125 6.28125 L 11 23.5625 L 3.71875 16.28125 L 2.28125 17.71875 L 10.28125 25.71875 L 11 26.40625 L 11.71875 25.71875 L 29.71875 7.71875 Z"/></svg>

After

Width:  |  Height:  |  Size: 222 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 16 2 C 14.742188 2 13.847656 2.890625 13.40625 4 L 5 4 L 5 29 L 27 29 L 27 4 L 18.59375 4 C 18.152344 2.890625 17.257813 2 16 2 Z M 16 4 C 16.554688 4 17 4.445313 17 5 L 17 6 L 20 6 L 20 8 L 12 8 L 12 6 L 15 6 L 15 5 C 15 4.445313 15.445313 4 16 4 Z M 7 6 L 10 6 L 10 10 L 22 10 L 22 6 L 25 6 L 25 27 L 7 27 Z M 21.28125 13.28125 L 15 19.5625 L 11.71875 16.28125 L 10.28125 17.71875 L 14.28125 21.71875 L 15 22.40625 L 15.71875 21.71875 L 22.71875 14.71875 Z"/></svg>

After

Width:  |  Height:  |  Size: 538 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 15 3 C 13.742188 3 12.847656 3.890625 12.40625 5 L 5 5 L 5 28 L 13 28 L 13 30 L 27 30 L 27 14 L 25 14 L 25 5 L 17.59375 5 C 17.152344 3.890625 16.257813 3 15 3 Z M 15 5 C 15.554688 5 16 5.445313 16 6 L 16 7 L 19 7 L 19 9 L 11 9 L 11 7 L 14 7 L 14 6 C 14 5.445313 14.445313 5 15 5 Z M 7 7 L 9 7 L 9 11 L 21 11 L 21 7 L 23 7 L 23 14 L 13 14 L 13 26 L 7 26 Z M 15 16 L 25 16 L 25 28 L 15 28 Z"/></svg>

After

Width:  |  Height:  |  Size: 469 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 16 4 C 9.382813 4 4 9.382813 4 16 C 4 22.617188 9.382813 28 16 28 C 22.617188 28 28 22.617188 28 16 C 28 9.382813 22.617188 4 16 4 Z M 16 6 C 21.535156 6 26 10.464844 26 16 C 26 21.535156 21.535156 26 16 26 C 10.464844 26 6 21.535156 6 16 C 6 10.464844 10.464844 6 16 6 Z M 15 10 L 15 18 L 17 18 L 17 10 Z M 15 20 L 15 22 L 17 22 L 17 20 Z"/></svg>

After

Width:  |  Height:  |  Size: 419 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 7.21875 5.78125 L 5.78125 7.21875 L 14.5625 16 L 5.78125 24.78125 L 7.21875 26.21875 L 16 17.4375 L 24.78125 26.21875 L 26.21875 24.78125 L 17.4375 16 L 26.21875 7.21875 L 24.78125 5.78125 L 16 14.5625 Z"/></svg>

After

Width:  |  Height:  |  Size: 283 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 12 2 C 8.144531 2 5 5.144531 5 9 C 5 11.410156 6.230469 13.550781 8.09375 14.8125 C 4.527344 16.34375 2 19.882813 2 24 L 4 24 C 4 19.570313 7.570313 16 12 16 C 13.375 16 14.65625 16.359375 15.78125 16.96875 C 14.671875 18.34375 14 20.101563 14 22 C 14 26.40625 17.59375 30 22 30 C 26.40625 30 30 26.40625 30 22 C 30 17.59375 26.40625 14 22 14 C 20.253906 14 18.628906 14.574219 17.3125 15.53125 C 16.871094 15.253906 16.390625 15.019531 15.90625 14.8125 C 17.769531 13.550781 19 11.410156 19 9 C 19 5.144531 15.855469 2 12 2 Z M 12 4 C 14.773438 4 17 6.226563 17 9 C 17 11.773438 14.773438 14 12 14 C 9.226563 14 7 11.773438 7 9 C 7 6.226563 9.226563 4 12 4 Z M 22 16 C 25.324219 16 28 18.675781 28 22 C 28 25.324219 25.324219 28 22 28 C 18.675781 28 16 25.324219 16 22 C 16 18.675781 18.675781 16 22 16 Z M 21 18 L 21 21 L 18 21 L 18 23 L 21 23 L 21 26 L 23 26 L 23 23 L 26 23 L 26 21 L 23 21 L 23 18 Z"/></svg>

After

Width:  |  Height:  |  Size: 983 B

@@ -0,0 +1,6 @@
package resources
// TODO whitelabeling go:generate sass themes/scss/zitadel-alternative.scss themes/zitadel/css/zitadel.css
// scss
//go:generate sass themes/scss/zitadel.scss themes/zitadel/css/zitadel.css
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

@@ -0,0 +1,62 @@
const avatars = document.getElementsByClassName('lgn-avatar');
for (let i = 0; i < avatars.length; i++) {
const displayName = avatars[i].getAttribute('loginname');
if (displayName) {
const username = displayName.split('@')[0];
let separator = '_';
if (username.includes('-')) {
separator = '-';
}
if (username.includes('.')) {
separator = '.';
}
const split = username.split(separator);
const initials = split[0].charAt(0) + (split[1] ? split[1].charAt(0) : '');
avatars[i].getElementsByClassName('initials')[0].innerHTML = initials;
avatars[i].style.background = this.getColor(displayName);
// set default white text instead of contrast text mode
avatars[i].style.color = '#ffffff';
}
}
function getColor(userName) {
const colors = [
'linear-gradient(40deg, #B44D51 30%, rgb(241,138,138))',
'linear-gradient(40deg, #B75073 30%, rgb(234,96,143))',
'linear-gradient(40deg, #84498E 30%, rgb(214,116,230))',
'linear-gradient(40deg, #705998 30%, rgb(163,131,220))',
'linear-gradient(40deg, #5C6598 30%, rgb(135,148,222))',
'linear-gradient(40deg, #7F90D3 30%, rgb(181,196,247))',
'linear-gradient(40deg, #3E93B9 30%, rgb(150,215,245))',
'linear-gradient(40deg, #3494A0 30%, rgb(71,205,222))',
'linear-gradient(40deg, #25716A 30%, rgb(58,185,173))',
'linear-gradient(40deg, #427E41 30%, rgb(97,185,96))',
'linear-gradient(40deg, #89A568 30%, rgb(176,212,133))',
'linear-gradient(40deg, #90924D 30%, rgb(187,189,98))',
'linear-gradient(40deg, #E2B032 30%, rgb(245,203,99))',
'linear-gradient(40deg, #C97358 30%, rgb(245,148,118))',
'linear-gradient(40deg, #6D5B54 30%, rgb(152,121,108))',
'linear-gradient(40deg, #6B7980 30%, rgb(134,163,177))',
];
let hash = 0;
if (userName.length === 0) {
return colors[hash];
}
hash = this.hashCode(userName);
return colors[hash % colors.length];
}
function hashCode(str, seed = 0) {
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
for (let i = 0, ch; i < str.length; i++) {
ch = str.charCodeAt(i);
h1 = Math.imul(h1 ^ ch, 2654435761);
h2 = Math.imul(h2 ^ ch, 1597334677);
}
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
}
@@ -0,0 +1,68 @@
/*
* modified version of:
*
* base64-arraybuffer
* https://github.com/niklasvh/base64-arraybuffer
*
* Copyright (c) 2012 Niklas von Hertzen
* Licensed under the MIT license.
*/
"use strict";
let chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
// Use a lookup table to find the index.
let lookup = new Uint8Array(256);
for (var i = 0; i < chars.length; i++) {
lookup[chars.charCodeAt(i)] = i;
}
function encode(arraybuffer) {
let bytes = new Uint8Array(arraybuffer),
i, len = bytes.length, base64 = "";
for (i = 0; i < len; i += 3) {
base64 += chars[bytes[i] >> 2];
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
base64 += chars[bytes[i + 2] & 63];
}
if ((len % 3) === 2) {
base64 = base64.substring(0, base64.length - 1) + "=";
} else if (len % 3 === 1) {
base64 = base64.substring(0, base64.length - 2) + "==";
}
return base64;
}
function decode(base64) {
let bufferLength = base64.length * 0.75,
len = base64.length, i, p = 0,
encoded1, encoded2, encoded3, encoded4;
if (base64[base64.length - 1] === "=") {
bufferLength--;
if (base64[base64.length - 2] === "=") {
bufferLength--;
}
}
let arraybuffer = new ArrayBuffer(bufferLength),
bytes = new Uint8Array(arraybuffer);
for (i = 0; i < len; i += 4) {
encoded1 = lookup[base64.charCodeAt(i)];
encoded2 = lookup[base64.charCodeAt(i + 1)];
encoded3 = lookup[base64.charCodeAt(i + 2)];
encoded4 = lookup[base64.charCodeAt(i + 3)];
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
}
return arraybuffer;
}
@@ -0,0 +1,17 @@
function CheckChangePwPolicy() {
let policyElement = document.getElementById("change-new-password");
let pwNew = policyElement.value;
let pwNewConfirmation = document.getElementById("change-password-confirmation").value;
if (ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) === false) {
policyElement.setAttribute("color", "warn");
return false;
} else {
policyElement.setAttribute("color", "primary");
}
return pwNew == pwNewConfirmation;
}
let button = document.getElementById("change-password-button");
disableSubmit(CheckChangePwPolicy, button);
@@ -0,0 +1,6 @@
const copyToClipboard = str => {
navigator.clipboard.writeText(str);
};
let copyButton = document.getElementById("copy");
copyButton.addEventListener("click", copyToClipboard(copyButton.getAttribute("data-copy")));
@@ -0,0 +1,3 @@
let button = document.getElementById("submit-button");
disableSubmit(undefined, button);
@@ -0,0 +1,10 @@
let buttons1 = document.getElementsByName("linkbutton");
for (let i = 0; i < buttons1.length; i++) {
disableSubmit(undefined, buttons1[i]);
}
let buttons2 = document.getElementsByName("autoregisterbutton");
for (let i = 0; i < buttons2.length; i++) {
disableSubmit(undefined, buttons2[i]);
}
@@ -0,0 +1,58 @@
function disableSubmit(checks, button) {
let form = document.getElementsByTagName('form')[0];
let inputs = form.getElementsByTagName('input');
if (button) {
button.disabled = true;
}
addRequiredEventListener(inputs, checks, form, button);
disableDoubleSubmit(form, button);
toggleButton(checks, form, inputs, button);
}
function addRequiredEventListener(inputs, checks, form, button) {
let eventType = 'input';
for (i = 0; i < inputs.length; i++) {
if (inputs[i].required) {
eventType = 'input';
if (inputs[i].type === 'checkbox') {
eventType = 'click';
}
inputs[i].addEventListener(eventType, function () {
toggleButton(checks, form, inputs, button);
});
}
}
}
function disableDoubleSubmit(form, button) {
form.addEventListener('submit', function () {
document.body.classList.add('waiting');
button.disabled = true;
});
}
function toggleButton(checks, form, inputs, button) {
if (checks !== undefined) {
if (checks() === false) {
button.disabled = true;
return;
}
}
const targetValue = !allRequiredDone(form, inputs);
button.disabled = targetValue;
}
function allRequiredDone(form, inputs) {
for (i = 0; i < inputs.length; i++) {
if (inputs[i].required) {
if (inputs[i].type === 'checkbox' && !inputs[i].checked) {
return false;
}
if (inputs[i].value === '') {
return false;
}
}
}
return true;
}
@@ -0,0 +1,14 @@
function CheckInitPwPolicy() {
let policyElement = document.getElementById("password");
let pwNew = policyElement.value;
let pwNewConfirmation = document.getElementById("passwordconfirm").value;
if (ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) === false) {
return false;
}
return pwNew == pwNewConfirmation;
}
let button = document.getElementById("init-button");
disableSubmit(CheckInitPwPolicy, button);
@@ -0,0 +1,14 @@
const suffix = document.getElementById('default-login-suffix');
const suffixInput = document.getElementsByClassName('lgn-suffix-input')[0];
if (suffix && suffixInput) {
calculateOffset();
suffix.addEventListener("DOMCharacterDataModified", calculateOffset);
}
function calculateOffset() {
// add suffix width to inner right padding of the input field
if (suffix && suffixInput) {
suffixInput.style.paddingRight = `${(suffix.offsetWidth ?? 0) + 10}px`;
}
}
@@ -0,0 +1,17 @@
document.addEventListener('DOMContentLoaded', function () {
autoSubmit();
});
function autoSubmit() {
let form = document.getElementsByTagName('form')[0];
if (form) {
let button = document.getElementById("redirect-button");
if (button) {
button.addEventListener("click", function (event) {
location.reload();
event.preventDefault();
});
}
form.submit();
}
}
@@ -0,0 +1,38 @@
function RenderDefaultLoginnameSuffix() {
let orgNameText = document.getElementById("orgname").value;
let userName = document.getElementById("username");
let defaultLoginNameSuffix = document.getElementById("default-login-suffix");
let iamDomain = userName.dataset.iamDomain;
let orgDomain = orgNameText.replace(" ", "-");
if (orgDomain !== "") {
defaultLoginNameSuffix.innerText = "@" + orgDomain.toLowerCase() + "." + iamDomain;
} else {
defaultLoginNameSuffix.innerText = "";
}
offsetLabel();
}
window.addEventListener('DOMContentLoaded', (event) => {
RenderDefaultLoginnameSuffix();
});
document.getElementById("orgname").addEventListener('input', function () {
RenderDefaultLoginnameSuffix();
});
function offsetLabel() {
const suffix = document.getElementById('default-login-suffix');
const suffixInput = document.getElementsByClassName('lgn-suffix-input')[0];
calculateOffset();
suffix.addEventListener("DOMCharacterDataModified", calculateOffset);
function calculateOffset() {
// add suffix width to inner right padding of the input field
if (suffix && suffixInput) {
suffixInput.style.paddingRight = `${(suffix.offsetWidth ?? 0) + 10}px`;
}
}
}
@@ -0,0 +1,83 @@
function ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) {
let minLength = policyElement.dataset.minlength;
let upperRegex = policyElement.dataset.hasUppercase;
let lowerRegex = policyElement.dataset.hasLowercase;
let numberRegex = policyElement.dataset.hasNumber;
let symbolRegex = policyElement.dataset.hasSymbol;
let valid = true;
let minlengthelem = document.getElementById('minlength');
if (pwNew.length >= minLength) {
ValidPolicy(minlengthelem);
valid = true;
} else {
InvalidPolicy(minlengthelem);
valid = false;
}
let upper = document.getElementById('uppercase');
if (upperRegex !== "") {
if (RegExp(upperRegex).test(pwNew)) {
ValidPolicy(upper);
valid = true;
} else {
InvalidPolicy(upper);
valid = false;
}
}
let lower = document.getElementById('lowercase');
if (lowerRegex !== "") {
if (RegExp(lowerRegex).test(pwNew)) {
ValidPolicy(lower);
valid = true;
} else {
InvalidPolicy(lower);
valid = false;
}
}
let number = document.getElementById('number');
if (numberRegex != "") {
if (RegExp(numberRegex).test(pwNew)) {
ValidPolicy(number);
valid = true;
} else {
InvalidPolicy(number);
valid = false;
}
}
let symbol = document.getElementById('symbol');
if (symbolRegex != "") {
if (RegExp(symbolRegex).test(pwNew)) {
ValidPolicy(symbol);
valid = true;
} else {
InvalidPolicy(symbol);
valid = false;
}
}
let confirmation = document.getElementById('confirmation');
if (pwNew === pwNewConfirmation && pwNewConfirmation !== "" ) {
ValidPolicy(confirmation);
valid = true;
} else {
InvalidPolicy(confirmation);
valid = false;
}
return valid;
}
function ValidPolicy(element) {
element.classList.remove('invalid');
element.getElementsByTagName('i')[0].classList.remove('lgn-icon-times-solid');
element.getElementsByTagName('i')[0].classList.remove('lgn-warn');
element.getElementsByTagName('i')[0].classList.add('lgn-icon-check-solid');
element.getElementsByTagName('i')[0].classList.add('lgn-valid');
}
function InvalidPolicy(element) {
element.classList.add('invalid');
element.getElementsByTagName('i')[0].classList.remove('lgn-valid');
element.getElementsByTagName('i')[0].classList.remove('lgn-icon-check-solid');
element.getElementsByTagName('i')[0].classList.add('lgn-warn');
element.getElementsByTagName('i')[0].classList.add('lgn-icon-times-solid');
}
@@ -0,0 +1,17 @@
function CheckRegisterPwPolicy() {
let policyElement = document.getElementById("register-password");
let pwNew = policyElement.value;
let pwNewConfirmation = document.getElementById("register-password-confirmation").value;
if (ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) === false) {
policyElement.setAttribute("color", "warn");
return false;
} else {
policyElement.setAttribute("color", "primary");
}
return pwNew == pwNewConfirmation;
}
let button = document.getElementById("register-button");
disableSubmit(CheckRegisterPwPolicy, button);
@@ -0,0 +1,46 @@
const usesDarkTheme = hasDarkModeOverwriteCookie() || (!hasLightModeOverwriteCookie() && window.matchMedia('(prefers-color-scheme: dark)').matches);
if (usesDarkTheme) {
document.documentElement.classList.replace('lgn-light-theme', 'lgn-dark-theme');
writeModeCookie('dark');
} else {
document.documentElement.classList.replace('lgn-dark-theme', 'lgn-light-theme');
writeModeCookie('light');
}
function hasDarkModeOverwriteCookie() {
return getCookie('mode') === 'dark';
}
function hasLightModeOverwriteCookie() {
return getCookie('mode') === 'light';
}
function writeModeCookie(mode) {
let cookieMode = getCookie('mode')
if (cookieMode === '' || cookieMode.startsWith('auto')) {
setCookie('mode', 'auto-' + mode, 365);
}
}
function getCookie(cname) {
let name = cname + '=';
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) === ' ') {
c = c.substring(1);
}
if (c.indexOf(name) === 0) {
return c.substring(name.length, c.length);
}
}
return '';
}
function setCookie(name, value, exdays) {
let d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
let expires = "expires=" + d.toUTCString();
document.cookie = name + "=" + value + ";" + expires + ";path=/";
}
@@ -0,0 +1,31 @@
function checkWebauthnSupported(button, func) {
let support = document.getElementsByClassName("wa-support");
let noSupport = document.getElementsByClassName("wa-no-support");
if (!window.PublicKeyCredential) {
for (let item of noSupport) {
item.classList.remove('hidden');
}
for (let item of support) {
item.classList.add('hidden');
}
return;
}
document.getElementById(button).addEventListener('click', func);
}
function webauthnError(error) {
let err = document.getElementById('wa-error');
err.getElementsByClassName('cause')[0].innerText = error.message;
err.classList.remove('hidden');
}
function bufferDecode(value) {
return decode(value);
}
function bufferEncode(value) {
return encode(value)
.replace(/\+/g, "-")
.replace(/\//g, "_")
.replace(/=/g, "");
}
@@ -0,0 +1,41 @@
document.addEventListener('DOMContentLoaded', checkWebauthnSupported('btn-login', login));
function login() {
document.getElementById('wa-error').classList.add('hidden');
let makeAssertionOptions = JSON.parse(atob(document.getElementsByName('credentialAssertionData')[0].value));
makeAssertionOptions.publicKey.challenge = bufferDecode(makeAssertionOptions.publicKey.challenge);
makeAssertionOptions.publicKey.allowCredentials.forEach(function (listItem) {
listItem.id = bufferDecode(listItem.id)
});
navigator.credentials.get({
publicKey: makeAssertionOptions.publicKey
}).then(function (credential) {
verifyAssertion(credential);
}).catch(function (err) {
webauthnError(err);
});
}
function verifyAssertion(assertedCredential) {
let authData = new Uint8Array(assertedCredential.response.authenticatorData);
let clientDataJSON = new Uint8Array(assertedCredential.response.clientDataJSON);
let rawId = new Uint8Array(assertedCredential.rawId);
let sig = new Uint8Array(assertedCredential.response.signature);
let userHandle = new Uint8Array(assertedCredential.response.userHandle);
let data = JSON.stringify({
id: assertedCredential.id,
rawId: bufferEncode(rawId),
type: assertedCredential.type,
response: {
authenticatorData: bufferEncode(authData),
clientDataJSON: bufferEncode(clientDataJSON),
signature: bufferEncode(sig),
userHandle: bufferEncode(userHandle),
},
})
document.getElementsByName('credentialData')[0].value = btoa(data);
document.getElementsByTagName('form')[0].submit();
}
@@ -0,0 +1,42 @@
document.addEventListener('DOMContentLoaded', checkWebauthnSupported('btn-register', registerCredential));
function registerCredential() {
document.getElementById('wa-error').classList.add('hidden');
let opt = JSON.parse(atob(document.getElementsByName('credentialCreationData')[0].value));
opt.publicKey.challenge = bufferDecode(opt.publicKey.challenge);
opt.publicKey.user.id = bufferDecode(opt.publicKey.user.id);
if (opt.publicKey.excludeCredentials) {
for (let i = 0; i < opt.publicKey.excludeCredentials.length; i++) {
if (opt.publicKey.excludeCredentials[i].id !== null) {
opt.publicKey.excludeCredentials[i].id = bufferDecode(opt.publicKey.excludeCredentials[i].id);
}
}
}
navigator.credentials.create({
publicKey: opt.publicKey
}).then(function (credential) {
createCredential(credential);
}).catch(function (err) {
webauthnError(err);
});
}
function createCredential(newCredential) {
let attestationObject = new Uint8Array(newCredential.response.attestationObject);
let clientDataJSON = new Uint8Array(newCredential.response.clientDataJSON);
let rawId = new Uint8Array(newCredential.rawId);
let data = JSON.stringify({
id: newCredential.id,
rawId: bufferEncode(rawId),
type: newCredential.type,
response: {
attestationObject: bufferEncode(attestationObject),
clientDataJSON: bufferEncode(clientDataJSON),
},
});
document.getElementsByName('credentialData')[0].value = btoa(data);
document.getElementsByTagName('form')[0].submit();
}
@@ -0,0 +1,12 @@
// themes and colors
@import 'styles/theming/all';
@import 'styles/color/all_color';
@import 'styles/typography/typography';
// layouts
@import 'styles/container/container';
@import 'styles/register/register';
@import 'styles/header/header';
// animations
@import 'styles/animations';
@@ -0,0 +1,22 @@
body {
margin: 0 auto;
display: flex;
flex-direction: column;
height: 100vh;
.lgn-grow {
flex: 1;
}
&.waiting * {
cursor: wait !important;
}
}
.hidden {
display: none !important;
}
.text-align-center {
text-align: center;
}
@@ -0,0 +1,10 @@
a {
text-decoration: none;
outline: none;
cursor: pointer;
margin: 2px 0;
&.block {
display: block;
}
}
@@ -0,0 +1,18 @@
@import 'a';
@mixin lgn-a-theme() {
@include lgn-a-color();
}
@mixin lgn-a-color() {
a {
color: var(--zitadel-color-primary);
&:hover,
&:active {
color: var(--zitadel-color-primary-400);
}
}
}
@@ -0,0 +1,61 @@
$lgn-container-max-width: 380px;
$lgn-container-padding: 20px;
$lgn-container-margin: 0px auto 50px auto;
.lgn-account-selection{
display: flex;
flex-direction: column;
width: 100%;
.lgn-account {
display: flex;
align-items: center;
border: none;
outline: none;
cursor: pointer;
&:disabled {
cursor: not-allowed;
}
.left {
padding: .5rem 1rem;
}
.lgn-names {
display: block;
margin: .5rem;
text-align: start;
overflow: hidden;
.lgn-displayname{
font-size: 16px;
margin: .5rem 0;
margin-bottom: 0;
text-overflow: ellipsis;
overflow: hidden;
}
.lgn-loginname{
font-size: 14px;
margin: 0;
text-overflow: ellipsis;
overflow: hidden;
}
.lgn-session-state {
margin: 0;
font-size: 14px;
margin-bottom: .5rem;
}
}
.fill-space {
flex: 1;
}
i {
font-size: 1.2rem;
}
}
}
@@ -0,0 +1,51 @@
@import 'account_selection';
@mixin lgn-account-selection-theme() {
@include lgn-account-selection-color();
}
@mixin lgn-account-selection-color() {
.lgn-account-selection{
display: flex;
flex-direction: column;
width: 100%;
.lgn-account {
color: inherit;
background: transparent;
box-shadow: inset 0 -1px var(--zitadel-color-footer-line);
&:hover {
background-color: var(--zitadel-color-account-selector-hover);
}
&:focus {
background-color: var(--zitadel-color-account-selector-active);
}
&:active {
background-color: var(--zitadel-color-account-selector-active);
}
.lgn-loginname{
font-size: 14px;
color: var(--zitadel-color-label);
}
.lgn-session-state {
color: var(--zitadel-color-label);
&.i0 {
color: #85d996;
}
&.i1 {
color: var(--zitadel-color-warn);
}
}
}
}
}
@@ -0,0 +1,22 @@
@keyframes shake {
10%, 90% {
transform: translate3d(-1px, 0, 0);
}
20%, 80% {
transform: translate3d(2px, 0, 0);
}
30%, 50%, 70% {
transform: translate3d(-4px, 0, 0);
}
40%, 60% {
transform: translate3d(4px, 0, 0);
}
}
[shake] {
animation: shake .8s cubic-bezier(.36,.07,.19,.97) both;
transform: translate3d(0, 0, 0);
}
@@ -0,0 +1,25 @@
$lgn-container-max-width: 380px;
$lgn-container-padding: 20px;
$lgn-avatar-size: 32px;
.lgn-avatar {
height: $lgn-avatar-size;
width: $lgn-avatar-size;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
text-transform: uppercase;
box-sizing: border-box;
letter-spacing: .05em;
font-size: 14px;
outline: none;
font-weight: bold;
overflow: hidden;
}
.lgn-avatar .avatar-img {
height: 100%;
width: 100%;
object-fit: cover;
}
@@ -0,0 +1,45 @@
@import 'avatar';
@import "../elevation/elevation";
@mixin lgn-avatar-theme() {
@include lgn-avatar-color();
}
@mixin lgn-avatar-color() {
.lgn-avatar:not(.transparent) {
@include _lgn-avatar-theme-property("background-color", false);
@include lgn-avatar-elevation(2);
}
.lgn-avatar .initials{
@include _lgn-avatar-theme-property("color", true);
}
}
@mixin _lgn-avatar-theme-property($property, $contrast) {
$color: if($contrast, var(--zitadel-color-primary-contrast), var(--zitadel-color-primary));
&.lgn-primary {
#{$property}: $color;
}
&.lgn-accent {
#{$property}: $color;
}
&.lgn-warn {
#{$property}: $color;
}
&.lgn-primary,
&.lgn-accent,
&.lgn-warn,
&[disabled] {
&[disabled] {
$btn-color: if($property == "color", var(--zitadel-color-button-disabled), var(--itadel-color-button-disabled-background));
#{$property}: $btn-color;
}
}
}
@mixin lgn-avatar-elevation($zValue, $opacity: $lgn-elevation-opacity) {
@include lgn-elevation($zValue, rgb(0, 0, 0), $opacity);
}
@@ -0,0 +1,40 @@
@import 'button_base';
.lgn-button, .lgn-stroked-button, .lgn-icon-button {
@include lgn-button-base;
}
.lgn-raised-button {
@include lgn-raised-button;
}
.lgn-icon-button {
padding: 0;
min-width: 0;
width: $lgn-icon-button-size;
height: $lgn-icon-button-size;
flex-shrink: 0;
line-height: $lgn-icon-button-size;
border-radius: $lgn-icon-button-border-radius;
i, .mat-icon {
line-height: $lgn-icon-button-line-height;
}
}
.lgn-stroked-button {
border: $lgn-stroked-button-border-width solid currentColor;
padding: $lgn-stroked-button-padding;
line-height: $lgn-stroked-button-line-height;
}
.lgn-button:focus {
pointer-events: none;
transition: $lgn-button-focus-transition;
}
.lgn-button, .lgn-stroked-button, .lgn-raised-button {
* {
vertical-align: middle;
}
}
@@ -0,0 +1,59 @@
$lgn-button-padding: 0 16px !default;
$lgn-button-min-width: 64px !default;
$lgn-button-margin: 0 !default;
$lgn-button-line-height: 36px !default;
$lgn-button-border-radius: 6px !default;
$lgn-button-focus-transition: opacity 200ms cubic-bezier(0.35, 0, 0.25, 1),
background-color 200ms cubic-bezier(0.35, 0, 0.25, 1) !default;
// Stroked button padding is 1px less horizontally than default or raised lgn button
// button's padding.
$lgn-stroked-button-line-height: $lgn-button-line-height - 2;
$lgn-stroked-button-padding: 0 15px;
$lgn-stroked-button-border-width: 1px;
$lgn-icon-button-size: 40px !default;
$lgn-icon-button-border-radius: 50% !default;
$lgn-icon-button-line-height: 40px !default;
// adds base styles to all button types.
@mixin lgn-button-base {
box-sizing: border-box;
position: relative;
cursor: pointer;
outline: none;
border: none;
-webkit-tap-highlight-color: transparent;
// Make anchors (a href) render like buttons.
display: inline-block;
white-space: nowrap;
text-decoration: none;
vertical-align: baseline;
text-align: center;
// Sizing.
margin: $lgn-button-margin;
min-width: $lgn-button-min-width;
line-height: $lgn-button-line-height;
padding: $lgn-button-padding;
border-radius: $lgn-button-border-radius;
overflow: visible;
&[disabled] {
cursor: default;
}
&::-moz-focus-inner {
border: 0;
}
}
// Applies styles to buttons with backgrounds: raised
@mixin lgn-raised-button {
@include lgn-button-base;
// Force hardware acceleration.
transform: translate3d(0, 0, 0);
}
@@ -0,0 +1,183 @@
@import "../theming/theming";
@import "button";
@import "../elevation/elevation";
@mixin lgn-button-theme() {
@include lgn-button-color();
}
@mixin lgn-button-color() {
.lgn-button,
.lgn-stroked-button,
.lgn-icon-button {
color: inherit;
background: transparent;
@include _lgn-button-theme-color(false);
}
.lgn-button:focus,
.lgn-stroked-button:focus,
.lgn-raised-button:focus {
@include lgn-button-elevation(8);
background: var(--zitadel-color-background);
}
.lgn-stroked-button:not([disabled]) {
border-color: var(--zitadel-color-divider);
}
.lgn-button {
@include _lgn-button-theme-color(false);
&:hover {
background-color: rgba(var(--zitadel-color-primary-rgb), 0.1);
}
&:focus {
background-color: rgba(var(--zitadel-color-primary-rgb), 0.2);
}
&:active {
background-color: rgba(var(--zitadel-color-primary-rgb), 0.25);
}
}
.lgn-raised-button {
color: var(--zitadel-color-text);
background-color: var(--zitadel-color-raised-button-background);
@include _lgn-button-theme-color(true);
@include _lgn-button-theme-background-color();
&:active {
background-color: rgba(var(--zitadel-color-primary-rgb), 0.8);
}
}
.lgn-button,
.lgn-stroked-button {
@include lgn-button-elevation(0);
}
.lgn-raised-button {
@include lgn-button-elevation(2);
&:not([disabled]):active {
@include lgn-button-elevation(8);
}
// &:focus {
// @include lgn-b-elevation(8, $config);
// }
&[disabled] {
@include lgn-button-elevation(0);
}
}
}
@mixin _lgn-button-theme-color() {
&.lgn-primary {
color: var(--zitadel-color-primary);
}
&.lgn-accent {
color: var(--zitadel-color-secondary);
}
&.lgn-warn {
color: var(--zitadel-color-warn);
}
&.lgn-primary,
&.lgn-accent,
&.lgn-warn,
&[disabled] {
&[disabled] {
color: var(--zitadel-color-button-disabled);
}
}
}
@mixin _lgn-button-theme-background-color() {
&.lgn-primary {
background-color: var(--zitadel-color-primary);
}
&.lgn-accent {
background-color: var(--zitadel-color-secondary);
}
&.lgn-warn {
background-color: var(--zitadel-color-warn);
}
&.lgn-primary,
&.lgn-accent,
&.lgn-warn,
&[disabled] {
&[disabled] {
background-color: var(--zitadel-color-button-disabled-background);
}
}
}
@mixin _lgn-button-theme-color($contrast) {
$color: if($contrast, var(--zitadel-color-primary-contrast), var(--zitadel-color-primary));
&.lgn-primary {
color: $color;
}
&.lgn-accent {
color: $color;
}
&.lgn-warn {
color: $color;
}
&.lgn-primary,
&.lgn-accent,
&.lgn-warn,
&[disabled] {
&[disabled] {
color: var(--zitadel-color-button-disabled);
}
}
}
@mixin _lgn-button-theme-background-color() {
&.lgn-primary {
background-color: var(--zitadel-color-primary);
}
&.lgn-accent {
background-color: var(--zitadel-color-primary);
}
&.lgn-warn {
background-color: var(--zitadel-color-primary);
}
&.lgn-primary,
&.lgn-accent,
&.lgn-warn,
&[disabled] {
&[disabled] {
background-color: var(--zitadel-color-button-disabled-background);
}
}
}
@mixin _lgn-button-focus-overlay-color() {
&.lgn-primary:focus {
background-color: var(--zitadel-color-primary);
}
&.lgn-accent:focus {
background-color: var(--zitadel-color-secondary);
}
&.lgn-warn:focus {
background-color: var(--zitadel-color-warn);
}
}
@mixin lgn-button-elevation($zValue, $opacity: $lgn-elevation-opacity) {
@include lgn-elevation($zValue, rgb(0, 0, 0), $opacity);
}
@@ -0,0 +1,5 @@
@import 'checkbox_base';
.lgn-checkbox {
@include lgn-checkbox-base;
}
@@ -0,0 +1,54 @@
$lgn-checkbox-font-size: 14px !default;
@mixin lgn-checkbox-base {
display: inline-block;
position: relative;
margin: 0 0 10px;
font-size: $lgn-checkbox-font-size;
line-height: 24px;
box-sizing: inherit;
input[type='checkbox'] {
position: absolute;
top: 4px;
left: 0;
width: 16px;
height: 16px;
opacity: 0;
z-index: 0;
box-sizing: inherit;
}
// Unchecked
label {
display: block;
padding: 0 0 0 30px;
cursor: pointer;
box-sizing: inherit;
font-size: $lgn-checkbox-font-size;
line-height: 28px;
&:before {
content: '';
position: absolute;
top: 4px;
left: 0;
width: 16px;
height: 16px;
border-radius: 2px;
transition: all .28s cubic-bezier(.4, 0, .2, 1);
transition-property: background-color, border-color;
}
&:after {
content: '';
position: absolute;
top: 5px;
left: 5px;
width: 6px;
height: 12px;
transform: rotate(45deg);
transition: border-color .28s cubic-bezier(.4, 0, .2, 1);
}
}
}
@@ -0,0 +1,45 @@
@import '../theming/theming';
@import 'checkbox';
@mixin lgn-checkbox-theme() {
@include lgn-checkbox-color();
}
@mixin lgn-checkbox-color() {
input[type='checkbox'] {
position: absolute;
top: 4px;
left: 0;
width: 16px;
height: 16px;
opacity: 0;
z-index: 0;
}
// Unchecked
.lgn-checkbox label {
&:before {
background-color: transparent;
border: 2px solid var(--zitadel-color-input-border);
}
&:after {
border-bottom: 2px solid transparent;
border-right: 2px solid transparent;
background: transparent;
}
}
// Checked
input[type='checkbox']:checked + label {
&:before {
background-color: var(--zitadel-color-primary);
border-color: var(--zitadel-color-primary);
}
&:after {
border-color: #fff;
}
}
}
@@ -0,0 +1,19 @@
@import '../theming/all';
@import '../theming/theming';
// Includes all of the color styles.
@mixin zitadel-lgn-color($config-or-theme) {
// In case a theme object has been passed instead of a configuration for
// the color system, extract the color config from the theme object.
$config: if(lgn-private-is-theme-object($config-or-theme),
lgn-get-color-config($config-or-theme), $config-or-theme);
@if $config == null {
@error 'No color configuration specified.';
}
// includes all themes with given color
@include zitadel-lgn-theme((
color: $config,
));
}
@@ -0,0 +1,125 @@
$lgn-container-max-width: 400px;
$lgn-container-padding: 20px;
$lgn-container-margin: 0 auto 0 auto;
$lgn-container-top-offset: 100px;
$lgn-container-bottom-margin: 50px;
.lgn-max-width-wrapper {
max-width: $lgn-container-max-width;
margin: auto;
margin-top: 50px;
margin-bottom: $lgn-container-bottom-margin;
display: block;
@media only screen and (min-width: 600px) {
margin-top: $lgn-container-top-offset;
}
}
.content-container {
position: relative; // used to position a button element relative to the left upper corner of the content wrapper
display: block;
margin: $lgn-container-margin;
padding: $lgn-container-padding;
width: 100%;
box-sizing: border-box;
.lgn-head {
h1 {
text-align: center;
}
p {
text-align: center;
}
}
.lgn-actions {
display: flex;
align-items: center;
padding: .5rem 0;
margin-top: 1rem;
// this is used to reverse the submit button order.
//The form submits the htmls first element thus for displaying the desired button on the right side, items have to be reversed.
&.lgn-reverse-order {
flex-direction: row-reverse;
}
.fill-space {
flex: 1;
}
}
.lgn-row {
display: flex;
align-items: center;
padding: 0;
// this is used to reverse the submit button order.
//The form submits the htmls first element thus for displaying the desired button on the right side, items have to be reversed.
&.lgn-reverse-order {
flex-direction: row-reverse;
}
.fill-space {
flex: 1;
}
}
.lgn-login-profile {
margin-bottom: .5rem;
.lgn-profile-image {
display: block;
margin: .5rem;
}
.lgn-names {
border-width: 1px;
border-style: solid;
border-radius: 50vw;
display: flex;
align-items: center;
.inline-block {
display: inline-block;
margin: 0 2px;
}
.lgn-displayname{
margin: .5rem 1rem;
}
.lgn-loginname{
p {
margin: .5rem 1rem;
}
}
}
}
.lgn-left-action {
position: absolute;
left: 1rem;
top: -75px;
transform: translateY(-50%);
}
.lgn-register-options {
display: flex;
flex-direction: column;
}
.lgn-mfa-other {
display: flex;
flex-direction: column;
button {
width: 100%;
margin: .5rem 0;
}
}
}
i {
font-size: 1.2rem;
}
@@ -0,0 +1,20 @@
@import 'container';
@mixin lgn-container-theme() {
@include lgn-container-color();
}
@mixin lgn-container-color() {
.lgn-error {
.lgn-error-message {
color: var(--zitadel-color-warn);
}
}
.lgn-login-profile {
.lgn-names {
border-color: var(--zitadel-color-divider);
}
}
}
@@ -0,0 +1,25 @@
@mixin lgn-core($typography-config: null) {
@include zitadel-lgn-typography($typography-config);
}
@mixin lgn-core-color() {
// Wrapper element that provides the theme background
.lgn-app-background#{if(&, ', &.lgn-app-background', '')} {
background-color: var(--zitadel-color-background);
color: var(--zitadel-color-text);
}
// Marker that is used to determine whether the user has added a theme to their page.
@at-root {
.lgn-theme-loaded-marker {
display: none;
}
}
}
// Mixin that renders all of the core styles that depend on the theme.
@mixin lgn-core-theme() {
@include lgn-core-color();
}
@@ -0,0 +1,165 @@
@function _get-umbra-map($color, $opacity) {
$shadow-color: if(
type-of($color) == color,
rgba($color, $opacity * 0.2),
$color
);
@return (
0: "0px 0px 0px 0px #{$shadow-color}",
1: "0px 2px 1px -1px #{$shadow-color}",
2: "0px 3px 1px -2px #{$shadow-color}",
3: "0px 3px 3px -2px #{$shadow-color}",
4: "0px 2px 4px -1px #{$shadow-color}",
5: "0px 3px 5px -1px #{$shadow-color}",
6: "0px 3px 5px -1px #{$shadow-color}",
7: "0px 4px 5px -2px #{$shadow-color}",
8: "0px 5px 5px -3px #{$shadow-color}",
9: "0px 5px 6px -3px #{$shadow-color}",
10: "0px 6px 6px -3px #{$shadow-color}",
11: "0px 6px 7px -4px #{$shadow-color}",
12: "0px 7px 8px -4px #{$shadow-color}",
13: "0px 7px 8px -4px #{$shadow-color}",
14: "0px 7px 9px -4px #{$shadow-color}",
15: "0px 8px 9px -5px #{$shadow-color}",
16: "0px 8px 10px -5px #{$shadow-color}",
17: "0px 8px 11px -5px #{$shadow-color}",
18: "0px 9px 11px -5px #{$shadow-color}",
19: "0px 9px 12px -6px #{$shadow-color}",
20: "0px 10px 13px -6px #{$shadow-color}",
21: "0px 10px 13px -6px #{$shadow-color}",
22: "0px 10px 14px -6px #{$shadow-color}",
23: "0px 11px 14px -7px #{$shadow-color}",
24: "0px 11px 15px -7px #{$shadow-color}"
);
}
@function _get-penumbra-map($color, $opacity) {
$shadow-color: if(
type-of($color) == color,
rgba($color, $opacity * 0.14),
$color
);
@return (
0: "0px 0px 0px 0px #{$shadow-color}",
1: "0px 1px 1px 0px #{$shadow-color}",
2: "0px 2px 2px 0px #{$shadow-color}",
3: "0px 3px 4px 0px #{$shadow-color}",
4: "0px 4px 5px 0px #{$shadow-color}",
5: "0px 5px 8px 0px #{$shadow-color}",
6: "0px 6px 10px 0px #{$shadow-color}",
7: "0px 7px 10px 1px #{$shadow-color}",
8: "0px 8px 10px 1px #{$shadow-color}",
9: "0px 9px 12px 1px #{$shadow-color}",
10: "0px 10px 14px 1px #{$shadow-color}",
11: "0px 11px 15px 1px #{$shadow-color}",
12: "0px 12px 17px 2px #{$shadow-color}",
13: "0px 13px 19px 2px #{$shadow-color}",
14: "0px 14px 21px 2px #{$shadow-color}",
15: "0px 15px 22px 2px #{$shadow-color}",
16: "0px 16px 24px 2px #{$shadow-color}",
17: "0px 17px 26px 2px #{$shadow-color}",
18: "0px 18px 28px 2px #{$shadow-color}",
19: "0px 19px 29px 2px #{$shadow-color}",
20: "0px 20px 31px 3px #{$shadow-color}",
21: "0px 21px 33px 3px #{$shadow-color}",
22: "0px 22px 35px 3px #{$shadow-color}",
23: "0px 23px 36px 3px #{$shadow-color}",
24: "0px 24px 38px 3px #{$shadow-color}"
);
}
@function _get-ambient-map($color, $opacity) {
$shadow-color: if(
type-of($color) == color,
rgba($color, $opacity * 0.12),
$color
);
@return (
0: "0px 0px 0px 0px #{$shadow-color}",
1: "0px 1px 3px 0px #{$shadow-color}",
2: "0px 1px 5px 0px #{$shadow-color}",
3: "0px 1px 8px 0px #{$shadow-color}",
4: "0px 1px 10px 0px #{$shadow-color}",
5: "0px 1px 14px 0px #{$shadow-color}",
6: "0px 1px 18px 0px #{$shadow-color}",
7: "0px 2px 16px 1px #{$shadow-color}",
8: "0px 3px 14px 2px #{$shadow-color}",
9: "0px 3px 16px 2px #{$shadow-color}",
10: "0px 4px 18px 3px #{$shadow-color}",
11: "0px 4px 20px 3px #{$shadow-color}",
12: "0px 5px 22px 4px #{$shadow-color}",
13: "0px 5px 24px 4px #{$shadow-color}",
14: "0px 5px 26px 4px #{$shadow-color}",
15: "0px 6px 28px 5px #{$shadow-color}",
16: "0px 6px 30px 5px #{$shadow-color}",
17: "0px 6px 32px 5px #{$shadow-color}",
18: "0px 7px 34px 6px #{$shadow-color}",
19: "0px 7px 36px 6px #{$shadow-color}",
20: "0px 8px 38px 7px #{$shadow-color}",
21: "0px 8px 40px 7px #{$shadow-color}",
22: "0px 8px 42px 7px #{$shadow-color}",
23: "0px 9px 44px 8px #{$shadow-color}",
24: "0px 9px 46px 8px #{$shadow-color}"
);
}
$lgn-elevation-transition-duration: 280ms !default;
$lgn-elevation-transition-timing-function: cubic-bezier(
0.4,
0,
0.2,
1
) !default;
$lgn-elevation-color: black !default;
// scaling value for elevation shadows.
$lgn-elevation-opacity: 1 !default;
// Applies the correct css rules to an element to give it the elevation specified by $zValue.
// The $zValue must be between 0 and 24.
@mixin lgn-elevation(
$zValue,
$color: $lgn-elevation-color,
$opacity: $lgn-elevation-opacity
) {
@if type-of($zValue) != number or not unitless($zValue) {
@error '$zValue must be a unitless number';
}
@if $zValue < 0 or $zValue > 24 {
@error '$zValue must be between 0 and 24';
}
box-shadow: #{map-get(_get-umbra-map($color, $opacity), $zValue)},
#{map-get(_get-penumbra-map($color, $opacity), $zValue)},
#{map-get(_get-ambient-map($color, $opacity), $zValue)};
}
// Returns a string that can be used as the value for a transition property for elevation.
// Calling this function directly is useful in situations where a component needs to transition
// more than one property.
//
// .foo {
// transition: lgn-elevation-transition-property-value(), opacity 100ms ease;
// }
@function lgn-elevation-transition-property-value(
$duration: $lgn-elevation-transition-duration,
$easing: $lgn-elevation-transition-timing-function
) {
@return box-shadow #{$duration} #{$easing};
}
// Applies the correct css rules needed to have an element transition between elevations.
// This mixin should be applied to elements whose elevation values will change depending on their
// context (e.g. when active or disabled).
//
// NOTE(traviskaufman): Both this mixin and the above function use default parameters so they can
// be used in the same way by clients.
@mixin lgn-elevation-transition(
$duration: $lgn-elevation-transition-duration,
$easing: $lgn-elevation-transition-timing-function
) {
transition: lgn-elevation-transition-property-value($duration, $easing);
}

Some files were not shown because too many files have changed in this diff Show More