Files
COSMOS/templates/login.html
T
2026-11-07 00:30:41 +05:30

756 lines
21 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Sign In — Cosmos {{.Service}}</title>
<meta name="description" content="Sign in to your Cosmos {{.Service}} sovereign workspace."/>
<link rel="icon" href='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><circle cx="16" cy="16" r="6" fill="%23eef3f8"/><ellipse cx="16" cy="16" rx="14" ry="5.5" fill="none" stroke="%238fd9ff" stroke-width="1.5" transform="rotate(-24 16 16)"/></svg>'/>
<link rel="preconnect" href="https://fonts.googleapis.com"/>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@1&family=JetBrains+Mono:wght@300;400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet"/>
<style>
:root {
--bg: #020308;
--ink: #eef3f8;
--dim: rgba(226, 234, 242, 0.58);
--faint: rgba(226, 234, 242, 0.32);
--line: rgba(226, 234, 242, 0.08);
--line-strong: rgba(226, 234, 242, 0.16);
--ok: #43e5a0;
--ac: 143, 216, 255;
--ac-rgb: 143, 216, 255;
--mono: 'JetBrains Mono', ui-monospace, monospace;
--disp: 'Space Grotesk', -apple-system, sans-serif;
--serif: 'Instrument Serif', Georgia, serif;
--pad: clamp(24px, 5vw, 72px);
--ez: cubic-bezier(0.16, 1, 0.3, 1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
font-family: var(--disp);
background: var(--bg);
color: var(--ink);
min-height: 100vh;
min-height: 100svh;
display: flex;
flex-direction: column;
overflow-x: hidden;
-webkit-font-smoothing: antialiased;
position: relative;
selection-background: rgba(var(--ac-rgb), 0.3);
}
::selection { background: rgba(var(--ac-rgb), 0.3); color: #fff; }
a:focus-visible, button:focus-visible, input:focus-visible {
outline: 1px solid rgba(var(--ac-rgb), 0.7);
outline-offset: 3px;
border-radius: 6px;
}
/* ── 3D Viewport & Atmospheric Layers ── */
#webgl-bg {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
z-index: 1;
pointer-events: none;
}
.noise-overlay {
position: fixed;
inset: -10%;
width: 120%;
height: 120%;
z-index: 2;
pointer-events: none;
opacity: 0.045;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
background-size: 160px 160px;
}
.radial-vignette {
position: fixed;
inset: 0;
z-index: 2;
pointer-events: none;
background: radial-gradient(ellipse at 50% 45%, transparent 40%, rgba(2, 3, 8, 0.7) 85%, #020308 100%);
}
/* ── Top Navigation Bar ── */
.authbar {
position: relative;
z-index: 10;
display: flex;
justify-content: space-between;
align-items: center;
padding: 28px var(--pad) 12px;
font-family: var(--mono);
font-size: 10px;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.authbar a.back-link {
color: var(--dim);
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 8px;
transition: color 0.25s, transform 0.25s var(--ez);
}
.authbar a.back-link:hover {
color: #fff;
transform: translateX(-3px);
}
.authbar .channel-badge {
display: inline-flex;
align-items: center;
gap: 9px;
padding: 5px 12px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid var(--line);
color: var(--dim);
font-size: 9.5px;
backdrop-filter: blur(10px);
}
.authbar .pulse-dot {
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--ok);
box-shadow: 0 0 10px var(--ok);
animation: dotPulse 2.4s ease infinite;
}
@keyframes dotPulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.4; transform: scale(0.85); }
}
/* ── Main Auth Card Container ── */
.auth-shell {
position: relative;
z-index: 10;
flex: 1;
display: grid;
place-items: center;
padding: 20px var(--pad) 50px;
perspective: 1200px;
}
.card-wrapper {
width: 100%;
max-width: 440px;
will-change: transform;
}
/* ── Signature Stuudio/Jockey Floating 3D Card with Conic Edge Lighting ── */
.card-3d {
position: relative;
border-radius: 20px;
padding: 44px 38px 40px;
background: linear-gradient(145deg, rgba(10, 15, 28, 0.82), rgba(4, 7, 14, 0.88)) padding-box,
conic-gradient(from var(--rim-angle, 0deg) at var(--mx, 50%) var(--my, 50%),
rgba(143, 216, 255, 0.85) 0deg,
rgba(255, 255, 255, 0.1) 60deg,
rgba(143, 216, 255, 0.05) 160deg,
rgba(143, 216, 255, 0.45) 260deg,
rgba(143, 216, 255, 0.85) 360deg) border-box;
border: 1px solid transparent;
backdrop-filter: blur(28px);
-webkit-backdrop-filter: blur(28px);
box-shadow: 0 35px 85px rgba(0, 0, 0, 0.65), 0 0 50px rgba(143, 216, 255, 0.05);
transform-style: preserve-3d;
transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.3s;
}
.card-3d:hover {
box-shadow: 0 45px 100px rgba(0, 0, 0, 0.75), 0 0 60px rgba(143, 216, 255, 0.1);
}
/* Corner Reticle Accents */
.cnr {
position: absolute;
width: 14px;
height: 14px;
border: 1px solid rgba(var(--ac-rgb), 0.35);
pointer-events: none;
transition: border-color 0.3s, width 0.3s var(--ez), height 0.3s var(--ez);
}
.c1 { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.c2 { top: -1px; right: -1px; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.c3 { bottom: -1px; left: -1px; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.c4 { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }
.card-3d:focus-within .cnr {
border-color: rgba(var(--ac-rgb), 0.95);
width: 20px;
height: 20px;
box-shadow: 0 0 10px rgba(var(--ac-rgb), 0.2);
}
/* ── Brand Mark ── */
.brand {
display: inline-flex;
align-items: center;
gap: 12px;
text-decoration: none;
color: var(--ink);
margin-bottom: 30px;
}
.brand-icon {
width: 34px;
height: 34px;
animation: markSpin 24s linear infinite;
flex-shrink: 0;
}
@keyframes markSpin {
to { transform: rotate(360deg); }
}
.brand-text {
font-size: 18px;
font-weight: 600;
letter-spacing: -0.02em;
}
.brand-text em {
font-family: var(--serif);
font-style: italic;
font-weight: 400;
color: rgb(var(--ac-rgb));
margin-left: 2px;
}
/* Headings */
.h-title {
font-size: 26px;
font-weight: 600;
letter-spacing: -0.03em;
margin-bottom: 8px;
color: #fff;
}
.h-sub {
font-size: 14px;
color: var(--dim);
margin-bottom: 28px;
line-height: 1.5;
}
/* Error Alert Box */
.error-box {
background: rgba(248, 113, 113, 0.08);
border: 1px solid rgba(248, 113, 113, 0.3);
border-radius: 10px;
padding: 12px 16px;
margin-bottom: 22px;
font-size: 13.5px;
color: #f87171;
font-weight: 500;
display: none;
}
.error-box.visible { display: block; }
/* ── Form Inputs ── */
.form-group {
margin-bottom: 20px;
}
.form-label {
display: block;
font-family: var(--mono);
font-size: 9.5px;
font-weight: 500;
letter-spacing: 0.16em;
text-transform: uppercase;
color: rgba(226, 234, 242, 0.6);
margin-bottom: 8px;
}
.input-ctrl {
width: 100%;
background: rgba(226, 234, 242, 0.03);
border: 1px solid var(--line-strong);
color: #fff;
padding: 13px 16px;
border-radius: 11px;
font-size: 14.5px;
font-weight: 500;
font-family: inherit;
outline: none;
transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.input-ctrl::placeholder {
color: rgba(226, 234, 242, 0.28);
}
.input-ctrl:focus {
border-color: rgba(var(--ac-rgb), 0.65);
box-shadow: 0 0 0 3px rgba(var(--ac-rgb), 0.15);
background: rgba(226, 234, 242, 0.05);
}
.pwd-wrap {
position: relative;
}
.pwd-wrap .input-ctrl {
padding-right: 48px;
}
.pwd-toggle {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
cursor: pointer;
color: rgba(226, 234, 242, 0.38);
display: flex;
padding: 6px;
transition: color 0.2s;
}
.pwd-toggle:hover {
color: var(--ink);
}
.pwd-toggle svg { width: 18px; height: 18px; }
.pwd-toggle .slash { display: none; }
.pwd-toggle.shown .slash { display: block; }
.caps-warn {
display: none;
font-family: var(--mono);
font-size: 9.5px;
letter-spacing: 0.14em;
color: #fbbf24;
margin-top: 8px;
align-items: center;
gap: 7px;
text-transform: uppercase;
}
.caps-warn.on { display: flex; }
.caps-warn i {
width: 5px;
height: 5px;
background: #fbbf24;
border-radius: 1px;
box-shadow: 0 0 8px #fbbf24;
flex: none;
}
.forgot-link-row {
text-align: right;
margin-top: 9px;
}
.forgot-link-row a {
font-size: 12.5px;
color: rgba(226, 234, 242, 0.45);
text-decoration: none;
font-family: var(--mono);
letter-spacing: 0.04em;
transition: color 0.2s;
}
.forgot-link-row a:hover {
color: rgb(var(--ac-rgb));
}
/* ── Magnetic Submit Button ── */
.btn-submit {
width: 100%;
padding: 14px 24px;
border-radius: 11px;
border: none;
background: #fff;
color: #04060d;
font-family: inherit;
font-size: 14.5px;
font-weight: 700;
cursor: pointer;
letter-spacing: -0.01em;
box-shadow: 0 8px 30px rgba(255, 255, 255, 0.12);
transition: transform 0.2s var(--ez), box-shadow 0.25s, opacity 0.25s;
margin-top: 6px;
position: relative;
overflow: hidden;
}
.btn-submit:hover {
box-shadow: 0 12px 40px rgba(255, 255, 255, 0.22);
transform: translateY(-1px);
}
.btn-submit:active {
transform: scale(0.985);
}
.btn-submit:disabled {
opacity: 0.75;
cursor: wait;
}
/* ── Auth Footer ── */
.auth-footer {
text-align: center;
margin-top: 26px;
font-size: 13.5px;
color: rgba(226, 234, 242, 0.42);
}
.auth-footer a {
color: rgb(var(--ac-rgb));
text-decoration: none;
font-weight: 600;
margin-left: 4px;
transition: color 0.2s;
}
.auth-footer a:hover {
color: #fff;
}
/* ── Page Footer ── */
.authfoot {
position: relative;
z-index: 10;
padding: 20px var(--pad);
display: flex;
justify-content: center;
font-family: var(--mono);
font-size: 9px;
letter-spacing: 0.2em;
color: rgba(226, 234, 242, 0.25);
text-transform: uppercase;
gap: 18px;
flex-wrap: wrap;
}
@media (max-width: 480px) {
.card-3d { padding: 36px 24px 30px; }
.authbar { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}
</style>
</head>
<body>
<!-- Three.js Ambient 3D Starfield & Orbital Precession Viewport -->
<div id="webgl-bg" aria-hidden="true"></div>
<div class="noise-overlay" aria-hidden="true"></div>
<div class="radial-vignette" aria-hidden="true"></div>
<header class="authbar">
<a href="/" class="back-link">&#8592; Cosmos Core</a>
<div class="channel-badge">
<span class="pulse-dot"></span>
<span data-scr>SECURE CHANNEL · {{.Service}}</span>
</div>
</header>
<main class="auth-shell">
<div class="card-wrapper" id="cardWrapper">
<div class="card-3d" id="card">
<i class="cnr c1"></i><i class="cnr c2"></i><i class="cnr c3"></i><i class="cnr c4"></i>
<a href="/" class="brand">
<svg class="brand-icon" viewBox="0 0 34 34" aria-hidden="true">
<ellipse cx="17" cy="17" rx="14.5" ry="6" fill="none" stroke="rgba(238,243,248,.55)" stroke-width="1.2" transform="rotate(-24 17 17)"/>
<circle cx="17" cy="17" r="4.4" fill="#eef3f8"/>
<circle cx="27.4" cy="12.2" r="1.8" fill="rgb(var(--ac-rgb))"/>
</svg>
<span class="brand-text">Cosmos <em>{{.Service}}</em></span>
</a>
<h1 class="h-title">Welcome back</h1>
<p class="h-sub">Sign in to your sovereign enclave to continue</p>
{{if .Error}}
<div class="error-box visible">{{.Error}}</div>
{{end}}
<form action="/{{.Service}}/login" method="POST" id="loginForm">
<div class="form-group">
<label class="form-label" for="lg-email">Username or Email</label>
<input type="text" id="lg-email" name="email" class="input-ctrl" placeholder="janedoe or [email protected]" required autocomplete="username"/>
</div>
<div class="form-group">
<label class="form-label" for="pwd">Password</label>
<div class="pwd-wrap">
<input type="password" name="password" id="pwd" class="input-ctrl" placeholder="••••••••" required autocomplete="current-password"/>
<button type="button" class="pwd-toggle" onclick="togglePwd('pwd')" aria-label="Toggle password visibility">
<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
<circle cx="12" cy="12" r="3"/>
<line class="slash" x1="4" y1="4" x2="20" y2="20" stroke-linecap="round"/>
</svg>
</button>
</div>
<div class="caps-warn"><i></i>Caps Lock is on</div>
<div class="forgot-link-row">
<a href="/{{.Service}}/forgot-password">Forgot password?</a>
</div>
</div>
<button type="submit" class="btn-submit" id="submitBtn">Sign In</button>
</form>
<div class="auth-footer">
Don't have an account? <a href="/{{.Service}}/signup">Create one</a>
</div>
</div>
</div>
</main>
<footer class="authfoot">
<span>51.4778° N · 0.0015° W</span>
<span>Zero Cloud Leakage</span>
<span>Sovereign Enclave</span>
</footer>
<!-- Local Zero-Latency Three.js Engine -->
<script src="/three.min.js"></script>
<script>
/* ══ 1. THREE.JS 3D CELESTIAL BACKGROUND ══ */
(function(){
'use strict';
var container = document.getElementById('webgl-bg');
if(!window.THREE || !container) return;
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.z = 28;
var renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true, powerPreference: 'high-performance' });
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
container.appendChild(renderer.domElement);
// Deep Starfield Particle Nodes
var starCount = 1400;
var starGeo = new THREE.BufferGeometry();
var starPos = new Float32Array(starCount * 3);
var starColors = new Float32Array(starCount * 3);
var colA = new THREE.Color(0x8fd9ff);
var colB = new THREE.Color(0xffffff);
var colC = new THREE.Color(0x43e5a0);
for(var i = 0; i < starCount; i++){
var i3 = i * 3;
starPos[i3] = (Math.random() - 0.5) * 80;
starPos[i3 + 1] = (Math.random() - 0.5) * 60;
starPos[i3 + 2] = (Math.random() - 0.5) * 50 - 5;
var roll = Math.random();
var c = roll < 0.6 ? colB : (roll < 0.85 ? colA : colC);
starColors[i3] = c.r;
starColors[i3 + 1] = c.g;
starColors[i3 + 2] = c.b;
}
starGeo.setAttribute('position', new THREE.BufferAttribute(starPos, 3));
starGeo.setAttribute('color', new THREE.BufferAttribute(starColors, 3));
var starMat = new THREE.PointsMaterial({
size: 0.18,
vertexColors: true,
transparent: true,
opacity: 0.75,
blending: THREE.AdditiveBlending
});
var starField = new THREE.Points(starGeo, starMat);
scene.add(starField);
// Subtle 3D Gyroscopic Rings Floating in Celestial Horizon
var ringGroup = new THREE.Group();
scene.add(ringGroup);
var r1Geo = new THREE.TorusGeometry(12, 0.02, 16, 120);
var r1Mat = new THREE.MeshBasicMaterial({ color: 0x8fd9ff, transparent: true, opacity: 0.18 });
var ring1 = new THREE.Mesh(r1Geo, r1Mat);
ring1.rotation.x = Math.PI / 3;
ringGroup.add(ring1);
var r2Geo = new THREE.TorusGeometry(15, 0.015, 16, 120);
var r2Mat = new THREE.MeshBasicMaterial({ color: 0x43e5a0, transparent: true, opacity: 0.1 });
var ring2 = new THREE.Mesh(r2Geo, r2Mat);
ring2.rotation.y = Math.PI / 4;
ring2.rotation.x = Math.PI / 5;
ringGroup.add(ring2);
var mouse = { x: 0, y: 0, targetX: 0, targetY: 0 };
window.addEventListener('mousemove', function(e){
mouse.targetX = (e.clientX / window.innerWidth - 0.5) * 2;
mouse.targetY = -(e.clientY / window.innerHeight - 0.5) * 2;
}, { passive: true });
window.addEventListener('resize', function(){
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
var clock = new THREE.Clock();
function animate(){
requestAnimationFrame(animate);
if(document.hidden) return;
var elapsedTime = clock.getElapsedTime();
mouse.x += (mouse.targetX - mouse.x) * 0.05;
mouse.y += (mouse.targetY - mouse.y) * 0.05;
starField.rotation.y = elapsedTime * 0.015;
starField.rotation.x = elapsedTime * 0.008;
ring1.rotation.z = elapsedTime * 0.04;
ring2.rotation.z = -elapsedTime * 0.03;
ringGroup.position.x = mouse.x * 1.5;
ringGroup.position.y = mouse.y * 1.2;
camera.position.x = mouse.x * 2;
camera.position.y = mouse.y * 1.5;
camera.lookAt(scene.position);
renderer.render(scene, camera);
}
animate();
})();
/* ══ 2. STUUDIO/JOCKEY SIGNATURE 3D CARD TILT & CONIC RIM LIGHT ══ */
(function(){
'use strict';
var card = document.getElementById('card');
var wrapper = document.getElementById('cardWrapper');
if(!card || !wrapper) return;
var rect = null;
function updateRect(){ rect = card.getBoundingClientRect(); }
window.addEventListener('resize', updateRect);
updateRect();
var currentTiltX = 0, currentTiltY = 0;
var targetTiltX = 0, targetTiltY = 0;
window.addEventListener('mousemove', function(e){
if(!rect) updateRect();
var cx = rect.left + rect.width / 2;
var cy = rect.top + rect.height / 2;
var dx = e.clientX - cx;
var dy = e.clientY - cy;
// Conic Rim Lighting angle and position
var angle = Math.atan2(dy, dx) * (180 / Math.PI) + 90;
card.style.setProperty('--rim-angle', angle + 'deg');
var mxPercent = Math.max(0, Math.min(100, ((e.clientX - rect.left) / rect.width) * 100));
var myPercent = Math.max(0, Math.min(100, ((e.clientY - rect.top) / rect.height) * 100));
card.style.setProperty('--mx', mxPercent + '%');
card.style.setProperty('--my', myPercent + '%');
// 3D perspective tilt calculation
var dist = Math.hypot(dx, dy);
var maxDist = Math.hypot(window.innerWidth, window.innerHeight) / 2;
if(dist < maxDist){
targetTiltY = (dx / (rect.width * 1.8)) * 12;
targetTiltX = -(dy / (rect.height * 1.8)) * 12;
} else {
targetTiltX = 0;
targetTiltY = 0;
}
}, { passive: true });
window.addEventListener('mouseleave', function(){
targetTiltX = 0;
targetTiltY = 0;
});
function tiltLoop(){
currentTiltX += (targetTiltX - currentTiltX) * 0.08;
currentTiltY += (targetTiltY - currentTiltY) * 0.08;
card.style.transform = 'rotateX(' + currentTiltX.toFixed(2) + 'deg) rotateY(' + currentTiltY.toFixed(2) + 'deg)';
requestAnimationFrame(tiltLoop);
}
tiltLoop();
})();
/* ══ 3. ORIGINAL PRESERVED AUTH BEHAVIORS ══ */
function togglePwd(id) {
var el = document.getElementById(id);
el.type = el.type === 'password' ? 'text' : 'password';
var b = el.parentElement.querySelector('.pwd-toggle');
if (b) b.classList.toggle('shown');
}
document.getElementById('loginForm').addEventListener('submit', function() {
var btn = document.getElementById('submitBtn');
btn.textContent = 'Signing in…';
btn.style.opacity = '0.75';
btn.disabled = true;
});
/* Caps Lock detection */
document.querySelectorAll('input[type=password]').forEach(function(inp){
function checkCaps(e){
var on = e.getModifierState && e.getModifierState('CapsLock');
var group = inp.closest('.form-group');
if(!group) return;
var warn = group.querySelector('.caps-warn');
if(warn) warn.classList.toggle('on', !!on);
}
inp.addEventListener('keyup', checkCaps);
inp.addEventListener('keydown', checkCaps);
});
/* Scramble decode on secure channel badge */
(function(){
'use strict';
function scramble(el){
var tgt = el.dataset.txt;
var f = 0, total = Math.max(16, tgt.length * 1.2), CH = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<>/[]·';
var iv = setInterval(function(){
f++;
var done = Math.floor(tgt.length * f / total), s = '';
for(var i = 0; i < tgt.length; i++){
var ch = tgt[i];
s += i < done ? ch : (ch === ' ' ? ' ' : CH[Math.random() * CH.length | 0]);
}
el.textContent = s;
if(f >= total){ el.textContent = tgt; clearInterval(iv); }
}, 28);
}
document.querySelectorAll('[data-scr]').forEach(function(el){
el.dataset.txt = el.textContent;
});
setTimeout(function(){
var t = document.querySelector('[data-scr]');
if(t) scramble(t);
}, 350);
})();
</script>
</body>
</html>