Private
Public Access
1
0

new: usr: implement the 2FA authentication (TOTP and backup codes) #4

This commit is contained in:
2026-04-12 17:55:57 +02:00
parent 0144a3953c
commit fb8a54f687
23 changed files with 1603 additions and 266 deletions

View File

@@ -207,6 +207,74 @@
&:active { transform: translateY(0); }
}
.auth-cancel {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
background: linear-gradient(to bottom, #1a1a1a 0%, #2d2d2d 55%, #404040 100%);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 5px;
color: #ffffff;
font: 700 16px 'Rajdhani', sans-serif;
text-transform: uppercase;
letter-spacing: 3px;
padding: 14px;
cursor: pointer;
margin-top: 6px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
transition: all 220ms ease;
&:hover {
background: linear-gradient(to bottom, #2d2d2d 0%, #3d3d3d 55%, #505050 100%);
box-shadow: 0 6px 28px rgba(0, 0, 0, 0.6);
transform: translateY(-2px);
}
&:active { transform: translateY(0); }
}
.auth-actions {
display: flex;
gap: 12px;
width: 100%;
align-items: flex-start;
form {
flex: 1;
display: flex;
&.auth-form {
flex-direction: column;
gap: 20px;
}
}
button {
flex: 1;
}
}
.auth-cancel-form {
display: flex;
flex: 1;
.auth-cancel {
flex: 1;
margin-top: 0;
}
}
.auth-cancel-standalone {
margin-top: 12px;
width: 100%;
}
.auth-cancel--block {
width: 100%;
margin-top: 0;
}
.auth-switch {
font: 400 13px 'Rajdhani', sans-serif;
color: rgba(255, 255, 255, 0.35);
@@ -285,3 +353,78 @@
.auth-passkey-btn:active {
transform: translateY(0);
}
.auth-input--code {
font: 700 22px 'Courier New', monospace;
letter-spacing: 6px;
text-align: center;
}
.auth-field-hint {
font: 400 12px 'Rajdhani', sans-serif;
color: rgba(149, 207, 245, 0.45);
letter-spacing: 0.3px;
margin: 6px 0 0;
}
.auth-card--wide {
max-width: 520px;
}
.auth-back {
margin-top: 20px;
text-align: center;
a {
font: 500 13px 'Rajdhani', sans-serif;
color: rgba(149, 207, 245, 0.5);
text-decoration: none;
letter-spacing: 0.5px;
transition: color 180ms;
&:hover { color: rgba(149, 207, 245, 0.9); }
}
}
.twofa-setup {
display: flex;
flex-direction: column;
gap: 24px;
margin-top: 20px;
&__qr {
display: flex;
justify-content: center;
img {
border-radius: 8px;
border: 2px solid rgba(35, 111, 135, 0.3);
background: #fff;
padding: 4px;
}
}
&__manual {
text-align: center;
}
&__manual-label {
font: 400 12px 'Rajdhani', sans-serif;
color: rgba(149, 207, 245, 0.45);
letter-spacing: 0.5px;
margin: 0 0 8px;
}
&__secret {
display: inline-block;
padding: 6px 14px;
background: rgba(0, 0, 0, 0.35);
border: 1px solid rgba(35, 111, 135, 0.3);
border-radius: 4px;
font: 700 14px 'Courier New', monospace;
letter-spacing: 3px;
color: #95cff5;
word-break: break-all;
user-select: all;
}
}

View File

@@ -1,304 +1,362 @@
.profile-page {
max-width: 760px;
margin: 0 auto;
padding: 48px 24px 80px;
display: flex;
flex-direction: column;
gap: 32px;
max-width: 760px;
margin: 0 auto;
padding: 48px 24px 80px;
display: flex;
flex-direction: column;
gap: 32px;
}
.profile-header {
display: flex;
align-items: center;
gap: 28px;
padding: 32px 36px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(35, 111, 135, 0.2);
border-radius: 10px;
backdrop-filter: blur(4px);
box-shadow: 0 8px 48px rgba(0, 0, 0, 0.4);
display: flex;
align-items: center;
gap: 28px;
padding: 32px 36px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(35, 111, 135, 0.2);
border-radius: 10px;
backdrop-filter: blur(4px);
box-shadow: 0 8px 48px rgba(0, 0, 0, 0.4);
}
.profile-avatar {
width: 80px;
height: 80px;
flex-shrink: 0;
border-radius: 50%;
background: linear-gradient(135deg, rgba(35, 111, 135, 0.45) 0%, rgba(173, 10, 5, 0.3) 100%);
border: 2px solid rgba(35, 111, 135, 0.45);
display: flex;
align-items: center;
justify-content: center;
font: 800 28px 'Rajdhani', sans-serif;
color: rgba(149, 207, 245, 0.9);
letter-spacing: 2px;
box-shadow:
0 0 0 4px rgba(35, 111, 135, 0.08),
0 0 24px rgba(35, 111, 135, 0.2);
width: 80px;
height: 80px;
flex-shrink: 0;
border-radius: 50%;
background: linear-gradient(135deg, rgba(35, 111, 135, 0.45) 0%, rgba(173, 10, 5, 0.3) 100%);
border: 2px solid rgba(35, 111, 135, 0.45);
display: flex;
align-items: center;
justify-content: center;
font: 800 28px 'Rajdhani', sans-serif;
color: rgba(149, 207, 245, 0.9);
letter-spacing: 2px;
box-shadow: 0 0 0 4px rgba(35, 111, 135, 0.08),
0 0 24px rgba(35, 111, 135, 0.2);
}
.profile-info {
display: flex;
flex-direction: column;
gap: 6px;
min-width: 0;
display: flex;
flex-direction: column;
gap: 6px;
min-width: 0;
}
.profile-name {
font: 800 32px 'Rajdhani', sans-serif;
color: #ffffff;
letter-spacing: 1px;
line-height: 1;
font: 800 32px 'Rajdhani', sans-serif;
color: #ffffff;
letter-spacing: 1px;
line-height: 1;
}
.profile-email {
font: 400 14px 'Rajdhani', sans-serif;
color: rgba(149, 207, 245, 0.6);
letter-spacing: 0.5px;
display: flex;
align-items: center;
gap: 7px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font: 400 14px 'Rajdhani', sans-serif;
color: rgba(149, 207, 245, 0.6);
letter-spacing: 0.5px;
display: flex;
align-items: center;
gap: 7px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
i { font-size: 11px; opacity: 0.7; }
i {
font-size: 11px;
opacity: 0.7;
}
}
.profile-role {
font: 600 11px 'Rajdhani', sans-serif;
text-transform: uppercase;
letter-spacing: 2.5px;
color: rgba(255, 255, 255, 0.25);
display: flex;
align-items: center;
gap: 6px;
font: 600 11px 'Rajdhani', sans-serif;
text-transform: uppercase;
letter-spacing: 2.5px;
color: rgba(255, 255, 255, 0.25);
display: flex;
align-items: center;
gap: 6px;
i { font-size: 10px; }
i {
font-size: 10px;
}
}
.profile-stats {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 14px;
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 14px;
}
.profile-stat {
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.07);
border-radius: 8px;
padding: 24px 16px 20px;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
transition: border-color 200ms ease, background 200ms ease;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.07);
border-radius: 8px;
padding: 24px 16px 20px;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
transition: border-color 200ms ease, background 200ms ease;
&:hover {
background: rgba(255, 255, 255, 0.05);
border-color: rgba(35, 111, 135, 0.3);
}
&--win {
border-color: rgba(42, 158, 96, 0.18);
&:hover {
background: rgba(255, 255, 255, 0.05);
border-color: rgba(35, 111, 135, 0.3);
border-color: rgba(42, 158, 96, 0.45);
}
}
&--win {
border-color: rgba(42, 158, 96, 0.18);
&:hover { border-color: rgba(42, 158, 96, 0.45); }
}
&--loss {
border-color: rgba(173, 10, 5, 0.18);
&--loss {
border-color: rgba(173, 10, 5, 0.18);
&:hover { border-color: rgba(173, 10, 5, 0.45); }
&:hover {
border-color: rgba(173, 10, 5, 0.45);
}
}
&--bomb {
border-color: rgba(246, 125, 82, 0.18);
&:hover { border-color: rgba(246, 125, 82, 0.45); }
&--bomb {
border-color: rgba(246, 125, 82, 0.18);
&:hover {
border-color: rgba(246, 125, 82, 0.45);
}
}
}
.profile-stat__icon {
font-size: 18px;
color: rgba(255, 255, 255, 0.15);
margin-bottom: 2px;
font-size: 18px;
color: rgba(255, 255, 255, 0.15);
margin-bottom: 2px;
.profile-stat--win & { color: rgba(94, 232, 154, 0.3); }
.profile-stat--loss & { color: rgba(246, 125, 82, 0.3); }
.profile-stat--bomb & { color: rgba(246, 125, 82, 0.25); }
.profile-stat--win & {
color: rgba(94, 232, 154, 0.3);
}
.profile-stat--loss & {
color: rgba(246, 125, 82, 0.3);
}
.profile-stat--bomb & {
color: rgba(246, 125, 82, 0.25);
}
}
.profile-stat__value {
display: block;
font: 800 40px 'Rajdhani', sans-serif;
color: #ffffff;
line-height: 1;
display: block;
font: 800 40px 'Rajdhani', sans-serif;
color: #ffffff;
line-height: 1;
.profile-stat--win & { color: #5ee89a; }
.profile-stat--loss & { color: #f67d52; }
.profile-stat--bomb & { color: rgba(246, 125, 82, 0.8); }
.profile-stat--win & {
color: #5ee89a;
}
.profile-stat--loss & {
color: #f67d52;
}
.profile-stat--bomb & {
color: rgba(246, 125, 82, 0.8);
}
}
.profile-stat__label {
font: 600 10px 'Rajdhani', sans-serif;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(255, 255, 255, 0.3);
font: 600 10px 'Rajdhani', sans-serif;
text-transform: uppercase;
letter-spacing: 2px;
color: rgba(255, 255, 255, 0.3);
}
.profile-actions {
display: flex;
gap: 10px;
flex-wrap: wrap;
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.profile-action-btn {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 9px 18px;
background: rgba(35, 111, 135, 0.12);
color: rgba(149, 207, 245, 0.75);
border: 1px solid rgba(35, 111, 135, 0.3);
border-radius: 6px;
display: inline-flex;
align-items: center;
gap: 8px;
padding: 9px 18px;
background: rgba(35, 111, 135, 0.12);
color: rgba(149, 207, 245, 0.75);
border: 1px solid rgba(35, 111, 135, 0.3);
border-radius: 6px;
text-decoration: none;
font: 600 12px 'Rajdhani', sans-serif;
letter-spacing: 1.5px;
text-transform: uppercase;
transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
i {
font-size: 11px;
opacity: 0.8;
}
&:hover {
background: rgba(35, 111, 135, 0.22);
border-color: rgba(35, 111, 135, 0.55);
color: rgba(149, 207, 245, 1);
text-decoration: none;
font: 600 12px 'Rajdhani', sans-serif;
letter-spacing: 1.5px;
text-transform: uppercase;
transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
i { font-size: 11px; opacity: 0.8; }
&:hover {
background: rgba(35, 111, 135, 0.22);
border-color: rgba(35, 111, 135, 0.55);
color: rgba(149, 207, 245, 1);
text-decoration: none;
}
}
}
.profile-section {
display: flex;
flex-direction: column;
gap: 14px;
display: flex;
flex-direction: column;
gap: 14px;
margin-bottom: 32px;
}
.profile-section__description {
font-size: 13px;
color: rgba(149, 207, 245, 0.65);
line-height: 1.6;
margin: 0;
font-size: 13px;
color: rgba(149, 207, 245, 0.65);
line-height: 1.6;
margin: 0;
}
.profile-section__title {
font: 700 11px 'Rajdhani', sans-serif;
text-transform: uppercase;
letter-spacing: 4px;
color: rgba(149, 207, 245, 0.45);
display: flex;
align-items: center;
gap: 8px;
font: 700 18px 'Rajdhani', sans-serif;
text-transform: uppercase;
letter-spacing: 4px;
color: rgba(149, 207, 245, 0.45);
display: flex;
align-items: center;
gap: 8px;
i { opacity: 0.7; }
i {
opacity: 0.7;
}
}
.profile-games {
display: flex;
flex-direction: column;
gap: 6px;
display: flex;
flex-direction: column;
gap: 6px;
}
.profile-game {
display: grid;
grid-template-columns: 26px 76px 22px 1fr 18px auto;
align-items: center;
gap: 10px;
padding: 11px 16px;
border-radius: 6px;
background: rgba(255, 255, 255, 0.025);
border: 1px solid rgba(255, 255, 255, 0.055);
border-left-width: 3px;
font: 500 14px 'Rajdhani', sans-serif;
transition: background 180ms ease;
display: grid;
grid-template-columns: 26px 76px 22px 1fr 18px auto;
align-items: center;
gap: 10px;
padding: 11px 16px;
border-radius: 6px;
background: rgba(255, 255, 255, 0.025);
border: 1px solid rgba(255, 255, 255, 0.055);
border-left-width: 3px;
font: 500 14px 'Rajdhani', sans-serif;
transition: background 180ms ease;
&:hover { background: rgba(255, 255, 255, 0.045); }
&:hover {
background: rgba(255, 255, 255, 0.045);
}
&--win { border-left-color: rgba(42, 158, 96, 0.55); }
&--loss { border-left-color: rgba(173, 10, 5, 0.55); }
&--draw { border-left-color: rgba(149, 207, 245, 0.25); }
&--win {
border-left-color: rgba(42, 158, 96, 0.55);
}
&--loss {
border-left-color: rgba(173, 10, 5, 0.55);
}
&--draw {
border-left-color: rgba(149, 207, 245, 0.25);
}
}
.profile-game__badge {
display: flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
border-radius: 4px;
font: 800 10px 'Rajdhani', sans-serif;
letter-spacing: 0;
display: flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
border-radius: 4px;
font: 800 10px 'Rajdhani', sans-serif;
letter-spacing: 0;
.profile-game--win & { background: rgba(42, 158, 96, 0.18); color: #5ee89a; }
.profile-game--loss & { background: rgba(173, 10, 5, 0.18); color: #f67d52; }
.profile-game--draw & { background: rgba(149, 207, 245, 0.1); color: rgba(149, 207, 245, 0.65); }
.profile-game--win & {
background: rgba(42, 158, 96, 0.18);
color: #5ee89a;
}
.profile-game--loss & {
background: rgba(173, 10, 5, 0.18);
color: #f67d52;
}
.profile-game--draw & {
background: rgba(149, 207, 245, 0.1);
color: rgba(149, 207, 245, 0.65);
}
}
.profile-game__score {
font: 700 14px 'Rajdhani', sans-serif;
color: #fff;
letter-spacing: 1px;
font: 700 14px 'Rajdhani', sans-serif;
color: #fff;
letter-spacing: 1px;
}
.profile-game__vs {
font: 400 10px 'Rajdhani', sans-serif;
color: rgba(255, 255, 255, 0.22);
text-transform: uppercase;
letter-spacing: 1px;
text-align: center;
font: 400 10px 'Rajdhani', sans-serif;
color: rgba(255, 255, 255, 0.22);
text-transform: uppercase;
letter-spacing: 1px;
text-align: center;
}
.profile-game__opponent {
color: rgba(149, 207, 245, 0.7);
letter-spacing: 0.5px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: rgba(149, 207, 245, 0.7);
letter-spacing: 0.5px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.profile-game__color {
font-size: 10px;
opacity: 0.6;
font-size: 10px;
opacity: 0.6;
}
.profile-game__date {
font: 400 11px 'Rajdhani', sans-serif;
color: rgba(255, 255, 255, 0.25);
letter-spacing: 0.5px;
text-align: right;
white-space: nowrap;
font: 400 11px 'Rajdhani', sans-serif;
color: rgba(255, 255, 255, 0.25);
letter-spacing: 0.5px;
text-align: right;
white-space: nowrap;
}
.profile-empty {
text-align: center;
padding: 48px 20px;
color: rgba(255, 255, 255, 0.25);
text-align: center;
padding: 48px 20px;
color: rgba(255, 255, 255, 0.25);
i {
font-size: 40px;
display: block;
margin-bottom: 16px;
opacity: 0.4;
i {
font-size: 40px;
display: block;
margin-bottom: 16px;
opacity: 0.4;
}
p {
font: 400 15px 'Rajdhani', sans-serif;
letter-spacing: 0.5px;
}
a {
color: #95cff5;
text-decoration: none;
font-weight: 600;
transition: color 180ms;
&:hover {
color: #c5e8ff;
}
p {
font: 400 15px 'Rajdhani', sans-serif;
letter-spacing: 0.5px;
}
a {
color: #95cff5;
text-decoration: none;
font-weight: 600;
transition: color 180ms;
&:hover { color: #c5e8ff; }
}
}
}
}

View File

@@ -1,3 +1,88 @@
.twofa-status {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 14px;
border-radius: 6px;
font: 600 13px 'Rajdhani', sans-serif;
letter-spacing: 0.5px;
&--enabled {
background: rgba(42, 158, 96, 0.12);
border: 1px solid rgba(42, 158, 96, 0.3);
color: #5ee89a;
}
&--disabled {
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.08);
color: rgba(255, 255, 255, 0.4);
}
}
.twofa-actions {
display: flex;
align-items: center;
gap: 20px;
flex-wrap: wrap;
&__form {
margin: 0;
}
}
.twofa-backup-meta {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
&__count {
font: 500 13px 'Rajdhani', sans-serif;
color: rgba(149, 207, 245, 0.55);
display: flex;
align-items: center;
gap: 6px;
}
}
.twofa-backup-reveal {
background: rgba(246, 125, 82, 0.07);
border: 1px solid rgba(246, 125, 82, 0.25);
border-radius: 8px;
padding: 18px 20px;
&__warning {
font: 600 12px 'Rajdhani', sans-serif;
text-transform: uppercase;
letter-spacing: 1.5px;
color: #f6a060;
margin: 0 0 14px;
display: flex;
align-items: center;
gap: 7px;
}
&__grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px;
}
}
.twofa-backup-code {
display: block;
text-align: center;
padding: 7px 10px;
background: rgba(0, 0, 0, 0.35);
border: 1px solid rgba(246, 125, 82, 0.2);
border-radius: 4px;
font: 700 13px 'Courier New', monospace;
letter-spacing: 2px;
color: #e0c890;
user-select: all;
}
$primary: #236f87;
$primary-dark: #1a5a70;
$danger: #c0392b;
@@ -203,4 +288,4 @@ $bg-hover: rgba(35, 111, 135, 0.15);
color: #64b5f6;
border: 1px solid rgba(25, 118, 210, 0.3);
}
}
}

View File

@@ -76,7 +76,7 @@ const useServerCommunication = (gameAssoc, gameInherited, isEnvDev) => {
const wInit = (revealedCells = []) => {
setGridReady(true);
showOverlay('We are waiting for your opponent...', gameAssoc ? (
showOverlay('Choose an opponent!', gameAssoc ? (
<WaitingOverlayContent
shareUrl={`${window.location.href}/${gameAssoc}`}
currentGameAssoc={gameAssoc}