Files
COSMOS/templates/login.html
T

739 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 space."/>
<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="%2338bdf8" 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=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet"/>
<script src="/three.min.js"></script>
<script>
if (typeof THREE === 'undefined') {
document.write('<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"><\/script>');
}
</script>
<style>
:root {
--bg: #03050d;
--card-bg: rgba(7, 12, 24, 0.78);
--ink: #f1f5f9;
--dim: rgba(226, 232, 240, 0.65);
--faint: rgba(226, 232, 240, 0.35);
--border: rgba(255, 255, 255, 0.08);
--border-focus: rgba(56, 189, 248, 0.6);
--cyan: #38bdf8;
--violet: #a855f7;
--amber: #f59e0b;
--emerald: #10b981;
--rose: #f43f5e;
--mono: 'JetBrains Mono', monospace;
--sans: 'Space Grotesk', system-ui, sans-serif;
--ez: cubic-bezier(0.16, 1, 0.3, 1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; height: 100%; }
body {
font-family: var(--sans);
background: var(--bg);
color: var(--ink);
overflow-x: hidden;
-webkit-font-smoothing: antialiased;
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
perspective: 1200px;
}
/* ── 3D Canvas Background ── */
#webgl-bg {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
z-index: 1;
pointer-events: none;
}
.cosmic-vignette {
position: fixed;
inset: 0;
z-index: 2;
pointer-events: none;
background: radial-gradient(circle at 50% 50%, transparent 20%, rgba(3, 5, 13, 0.6) 70%, #03050d 100%);
}
.cosmic-grid {
position: fixed;
inset: 0;
z-index: 2;
pointer-events: none;
opacity: 0.15;
background-image:
linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
background-size: 60px 60px;
mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 80%);
}
/* ── Header Bar ── */
.auth-nav {
position: relative;
z-index: 10;
display: flex;
justify-content: space-between;
align-items: center;
padding: 24px 32px;
}
.brand-link {
display: inline-flex;
align-items: center;
gap: 12px;
text-decoration: none;
color: #fff;
font-weight: 700;
font-size: 15px;
letter-spacing: -0.3px;
transition: transform 0.25s var(--ez), opacity 0.25s;
}
.brand-link:hover { transform: translateY(-1px); opacity: 0.9; }
.brand-icon {
width: 32px;
height: 32px;
border-radius: 9px;
background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(168, 85, 247, 0.2));
border: 1px solid rgba(255, 255, 255, 0.15);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}
.hud-badge {
font-family: var(--mono);
font-size: 11px;
letter-spacing: 0.08em;
text-transform: uppercase;
padding: 6px 14px;
border-radius: 99px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid var(--border);
color: var(--dim);
display: flex;
align-items: center;
gap: 8px;
}
.status-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: #22c55e;
box-shadow: 0 0 8px #22c55e;
animation: pulse 2s infinite ease-in-out;
}
@keyframes pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.4; transform: scale(0.85); }
}
/* ── Center Stage & Floating 3D Card ── */
.auth-stage {
position: relative;
z-index: 10;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 20px 24px;
}
.tilt-wrapper {
perspective: 1200px;
width: 100%;
max-width: 440px;
}
.auth-card {
background: var(--card-bg);
backdrop-filter: blur(28px);
-webkit-backdrop-filter: blur(28px);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 20px;
padding: 36px 32px;
box-shadow:
0 30px 80px rgba(0, 0, 0, 0.8),
0 0 40px rgba(56, 189, 248, 0.12),
inset 0 1px 0 rgba(255, 255, 255, 0.15);
transition: transform 0.15s ease-out, box-shadow 0.3s var(--ez);
position: relative;
overflow: hidden;
}
.auth-card::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0;
height: 2px;
background: linear-gradient(90deg, transparent, var(--cyan), var(--violet), transparent);
opacity: 0.8;
}
/* Service-Specific Accent Glow */
{{if eq .Service "git"}}
.auth-card::before {
background: linear-gradient(90deg, transparent, var(--amber), var(--emerald), transparent);
}
{{else if eq .Service "orbit"}}
.auth-card::before {
background: linear-gradient(90deg, transparent, #6366f1, var(--cyan), transparent);
}
{{end}}
/* Top Tabs (Sign In / Register) */
.tab-pills {
display: flex;
background: rgba(0, 0, 0, 0.45);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 12px;
padding: 4px;
margin-bottom: 26px;
}
.tab-pill {
flex: 1;
text-align: center;
font-size: 13px;
font-weight: 600;
padding: 8px 12px;
border-radius: 8px;
text-decoration: none;
color: var(--dim);
transition: all 0.25s var(--ez);
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
}
.tab-pill.active {
background: rgba(255, 255, 255, 0.1);
color: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.tab-pill:not(.active):hover {
color: #fff;
background: rgba(255, 255, 255, 0.04);
}
.card-title-wrap {
text-align: center;
margin-bottom: 24px;
}
.card-badge {
display: inline-flex;
align-items: center;
gap: 6px;
font-family: var(--mono);
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.1em;
padding: 3px 10px;
border-radius: 99px;
background: rgba(56, 189, 248, 0.1);
color: var(--cyan);
border: 1px solid rgba(56, 189, 248, 0.25);
margin-bottom: 10px;
}
{{if eq .Service "git"}}
.card-badge {
background: rgba(245, 158, 11, 0.1);
color: var(--amber);
border-color: rgba(245, 158, 11, 0.25);
}
{{else if eq .Service "orbit"}}
.card-badge {
background: rgba(99, 102, 241, 0.1);
color: #818cf8;
border-color: rgba(99, 102, 241, 0.25);
}
{{end}}
.card-h1 {
font-size: 24px;
font-weight: 700;
letter-spacing: -0.6px;
color: #fff;
}
.card-sub {
font-size: 13px;
color: var(--dim);
margin-top: 4px;
line-height: 1.4;
}
/* Error Banner */
.alert-error {
background: rgba(244, 63, 94, 0.1);
border: 1px solid rgba(244, 63, 94, 0.3);
color: #fca5a5;
font-size: 12.5px;
padding: 10px 14px;
border-radius: 10px;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 8px;
}
/* Inputs */
.form-group {
margin-bottom: 18px;
}
.input-label {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
font-weight: 600;
color: var(--dim);
margin-bottom: 8px;
}
.input-label a {
color: var(--cyan);
text-decoration: none;
font-size: 11.5px;
transition: color 0.2s;
}
.input-label a:hover { color: #fff; text-decoration: underline; }
.input-box {
position: relative;
display: flex;
align-items: center;
}
.input-icon {
position: absolute;
left: 14px;
width: 16px;
height: 16px;
color: var(--faint);
pointer-events: none;
transition: color 0.2s;
}
.form-input {
width: 100%;
background: rgba(0, 0, 0, 0.5);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
padding: 13px 40px 13px 40px;
font-family: inherit;
font-size: 14px;
color: #fff;
outline: none;
transition: all 0.25s var(--ez);
}
.form-input:focus {
border-color: var(--cyan);
background: rgba(56, 189, 248, 0.04);
box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}
.form-input:focus + .input-icon,
.input-box:focus-within .input-icon {
color: var(--cyan);
}
.eye-btn {
position: absolute;
right: 12px;
background: none;
border: none;
color: var(--faint);
cursor: pointer;
padding: 6px;
display: flex;
align-items: center;
justify-content: center;
transition: color 0.2s;
}
.eye-btn:hover { color: #fff; }
/* Primary Button */
.submit-btn {
width: 100%;
cursor: pointer;
background: linear-gradient(135deg, #38bdf8, #818cf8, #a855f7);
background-size: 200% 200%;
color: #fff;
border: none;
border-radius: 12px;
padding: 14px 20px;
font-family: inherit;
font-size: 14.5px;
font-weight: 700;
letter-spacing: -0.2px;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
margin-top: 10px;
box-shadow: 0 4px 20px rgba(56, 189, 248, 0.35);
transition: all 0.3s var(--ez);
}
{{if eq .Service "git"}}
.submit-btn {
background: linear-gradient(135deg, #f59e0b, #ea580c, #10b981);
box-shadow: 0 4px 20px rgba(245, 158, 11, 0.35);
}
{{else if eq .Service "orbit"}}
.submit-btn {
background: linear-gradient(135deg, #6366f1, #3b82f6, #06b6d4);
box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}
{{end}}
.submit-btn:hover {
transform: translateY(-2px);
filter: brightness(1.1);
box-shadow: 0 8px 28px rgba(56, 189, 248, 0.5);
}
.submit-btn:active {
transform: translateY(0);
}
/* Card Footer */
.card-footer {
margin-top: 24px;
padding-top: 18px;
border-top: 1px solid var(--border);
text-align: center;
font-size: 12px;
color: var(--dim);
display: flex;
align-items: center;
justify-content: center;
gap: 16px;
font-family: var(--mono);
}
.card-footer a {
color: var(--dim);
text-decoration: none;
transition: color 0.2s;
}
.card-footer a:hover { color: #fff; }
/* ── Bottom Bar ── */
.auth-foot {
position: relative;
z-index: 10;
padding: 16px 32px 24px;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 11px;
font-family: var(--mono);
color: var(--faint);
flex-wrap: wrap;
gap: 12px;
}
.auth-foot a {
color: var(--faint);
text-decoration: none;
transition: color 0.2s;
}
.auth-foot a:hover { color: #fff; }
</style>
</head>
<body>
<div id="webgl-bg"></div>
<div class="cosmic-vignette"></div>
<div class="cosmic-grid"></div>
<!-- Top Navigation -->
<header class="auth-nav">
<a href="/" class="brand-link">
<div class="brand-icon">
<svg width="18" height="18" viewBox="0 0 32 32"><ellipse cx="16" cy="16" rx="14" ry="5.5" fill="none" stroke="#38bdf8" stroke-width="1.8" transform="rotate(-24 16 16)"/><circle cx="16" cy="16" r="5" fill="#f8fafc"/></svg>
</div>
<span>Cosmos Cloud</span>
</a>
<div class="hud-badge">
<span class="status-dot"></span>
<span>Cosmos Core Online</span>
</div>
</header>
<!-- Main Interactive 3D Card Stage -->
<main class="auth-stage">
<div class="tilt-wrapper" id="cardTilt">
<div class="auth-card">
<!-- Mode Tabs -->
<div class="tab-pills">
<a href="/{{.Service}}/login" class="tab-pill active">
<svg width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/><polyline points="10 17 15 12 10 7"/><line x1="15" y1="12" x2="3" y2="12"/></svg>
Sign In
</a>
<a href="/{{.Service}}/signup" class="tab-pill">
<svg width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="8.5" cy="7" r="4"/><line x1="20" y1="8" x2="20" y2="14"/><line x1="23" y1="11" x2="17" y2="11"/></svg>
Create Space
</a>
</div>
<div class="card-title-wrap">
{{if eq .Service "git"}}
<span class="card-badge">Forge Git Service</span>
<h1 class="card-h1">Welcome back, Developer</h1>
<p class="card-sub">Access your private repositories, code review, and CI pipelines.</p>
{{else if eq .Service "orbit"}}
<span class="card-badge">Orbit Compute Engine</span>
<h1 class="card-h1">Command Bridge Access</h1>
<p class="card-sub">Deploy, monitor, and scale your sovereign container fleet.</p>
{{else}}
<span class="card-badge">Oort NAS &amp; Cloud</span>
<h1 class="card-h1">Sovereign Storage Terminal</h1>
<p class="card-sub">Lossless byte-range Mornye streaming and unified S3 buckets.</p>
{{end}}
</div>
{{if .Error}}
<div class="alert-error">
<svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
<span>{{.Error}}</span>
</div>
{{end}}
<form action="/{{.Service}}/login" method="POST" id="loginForm">
<div class="form-group">
<div class="input-label">
<span>Username or Email</span>
</div>
<div class="input-box">
<svg class="input-icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
<input type="text" id="lg-email" name="email" class="form-input" placeholder="username or [email protected]" required autocomplete="username" autofocus/>
</div>
</div>
<div class="form-group">
<div class="input-label">
<span>Password</span>
<a href="/{{.Service}}/forgot-password">Forgot Key?</a>
</div>
<div class="input-box">
<svg class="input-icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
<input type="password" id="pwd" name="password" class="form-input" placeholder="••••••••••••" required autocomplete="current-password"/>
<button type="button" class="eye-btn" onclick="togglePasswordVisibility()" aria-label="Toggle password visibility">
<svg id="eye-icon" width="16" height="16" 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"/></svg>
</button>
</div>
</div>
<button type="submit" class="submit-btn" id="submitBtn">
<span>Authorize Session</span>
<svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg>
</button>
</form>
<div class="card-footer">
<a href="/">← Cosmos Central</a>
<span>·</span>
<a href="/{{.Service}}/signup">New Space Signup</a>
</div>
</div>
</div>
</main>
<!-- Bottom Bar -->
<footer class="auth-foot">
<div>Encrypted with AES-256-GCM · Sovereign Infrastructure</div>
<div>Portals Go v2.4 · Zero Telemetry</div>
</footer>
<!-- ══ Three.js 3D Space Interactive Engine ══ -->
<script>
(function() {
const container = document.getElementById('webgl-bg');
if (!window.THREE || !container) return;
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 2000);
camera.position.z = 28;
const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true, powerPreference: "high-performance" });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
container.appendChild(renderer.domElement);
// 1. Deep Volumetric Starfield
const starCount = 1800;
const starGeo = new THREE.BufferGeometry();
const starPositions = new Float32Array(starCount * 3);
const starColors = new Float32Array(starCount * 3);
const serviceType = "{{.Service}}";
let primaryHue = 0.58; // Cyan default (Oort)
let accentHue = 0.78; // Violet default
if (serviceType === 'git') {
primaryHue = 0.08; // Amber
accentHue = 0.42; // Emerald
} else if (serviceType === 'orbit') {
primaryHue = 0.65; // Indigo
accentHue = 0.52; // Cyan
}
for (let i = 0; i < starCount; i++) {
const x = (Math.random() - 0.5) * 140;
const y = (Math.random() - 0.5) * 140;
const z = (Math.random() - 0.5) * 120;
starPositions[i * 3] = x;
starPositions[i * 3 + 1] = y;
starPositions[i * 3 + 2] = z;
const col = new THREE.Color();
const mix = Math.random();
col.setHSL(mix > 0.3 ? primaryHue : accentHue, 0.7, 0.6 + Math.random() * 0.4);
starColors[i * 3] = col.r;
starColors[i * 3 + 1] = col.g;
starColors[i * 3 + 2] = col.b;
}
starGeo.setAttribute('position', new THREE.BufferAttribute(starPositions, 3));
starGeo.setAttribute('color', new THREE.BufferAttribute(starColors, 3));
const starMat = new THREE.PointsMaterial({
size: 0.18,
vertexColors: true,
transparent: true,
opacity: 0.85,
blending: THREE.AdditiveBlending
});
const stars = new THREE.Points(starGeo, starMat);
scene.add(stars);
// 2. Central 3D Gyroscopic Rings (Space Portal Core)
const group = new THREE.Group();
scene.add(group);
const ringColor = serviceType === 'git' ? 0xf59e0b : (serviceType === 'orbit' ? 0x818cf8 : 0x38bdf8);
const coreColor = serviceType === 'git' ? 0x10b981 : (serviceType === 'orbit' ? 0x38bdf8 : 0xa855f7);
// Outer Orbital Ring
const ring1Geo = new THREE.RingGeometry(8.5, 8.55, 96);
const ring1Mat = new THREE.MeshBasicMaterial({ color: ringColor, side: THREE.DoubleSide, transparent: true, opacity: 0.55 });
const ring1 = new THREE.Mesh(ring1Geo, ring1Mat);
ring1.rotation.x = Math.PI / 3;
group.add(ring1);
// Middle Orbital Ring
const ring2Geo = new THREE.RingGeometry(6.2, 6.24, 80);
const ring2Mat = new THREE.MeshBasicMaterial({ color: coreColor, side: THREE.DoubleSide, transparent: true, opacity: 0.45 });
const ring2 = new THREE.Mesh(ring2Geo, ring2Mat);
ring2.rotation.y = Math.PI / 4;
ring2.rotation.x = -Math.PI / 6;
group.add(ring2);
// Inner Celestial Core (Wireframe Sphere)
const sphereGeo = new THREE.IcosahedronGeometry(2.4, 2);
const sphereMat = new THREE.MeshBasicMaterial({
color: 0xffffff,
wireframe: true,
transparent: true,
opacity: 0.18
});
const coreSphere = new THREE.Mesh(sphereGeo, sphereMat);
group.add(coreSphere);
// Mouse Parallax & Tilt
let mouseX = 0, mouseY = 0;
let targetX = 0, targetY = 0;
const windowHalfX = window.innerWidth / 2;
const windowHalfY = window.innerHeight / 2;
document.addEventListener('mousemove', (e) => {
mouseX = (e.clientX - windowHalfX);
mouseY = (e.clientY - windowHalfY);
targetX = mouseX * 0.0008;
targetY = mouseY * 0.0008;
// 3D Tilt on Auth Card
const card = document.getElementById('cardTilt');
if (card) {
const rx = -(e.clientY - windowHalfY) * 0.015;
const ry = (e.clientX - windowHalfX) * 0.015;
card.style.transform = `perspective(1000px) rotateX(${rx}deg) rotateY(${ry}deg)`;
}
});
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
// Animation Loop
let clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const delta = clock.getDelta();
group.rotation.y += 0.25 * delta;
group.rotation.x += 0.15 * delta;
ring1.rotation.z += 0.1 * delta;
ring2.rotation.z -= 0.12 * delta;
stars.rotation.y += 0.02 * delta;
// Smooth camera damping
camera.position.x += (targetX * 20 - camera.position.x) * 0.05;
camera.position.y += (-targetY * 20 - camera.position.y) * 0.05;
camera.lookAt(scene.position);
renderer.render(scene, camera);
}
animate();
})();
// Password Visibility Toggle
function togglePasswordVisibility() {
const pwd = document.getElementById('pwd');
const icon = document.getElementById('eye-icon');
if (!pwd) return;
if (pwd.type === 'password') {
pwd.type = 'text';
icon.innerHTML = '<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/>';
} else {
pwd.type = 'password';
icon.innerHTML = '<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"/>';
}
}
</script>
</body>
</html>