Files
project-managment/templates/auth/login.html
T
sankalp 40d435e48d fix(auth): simplify dark mode condition to only check explicit setting
Remove reliance on prefers-color-scheme when dark mode preference is explicitly stored, preventing unintended dark mode activation.
2026-06-28 18:36:25 +05:45

97 lines
6.5 KiB
HTML

{% load static tailwind_cli %}
<!DOCTYPE html>
<html lang="en" class="h-full">
<head>
<script>
(function() {
if (localStorage.getItem('darkMode') === 'true') {
document.documentElement.classList.add('dark');
}
})();
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="{% if branding and branding.favicon %}{{ branding.favicon.url }}{% else %}{% static 'img/favicon.ico' %}{% endif %}">
<title>{{ brand_name }} - Sign In</title>
<link href="https://fonts.bunny.net/css?family=instrument-sans:400,500,600,700" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
{% tailwind_css %}
<style>
* { font-family: 'Instrument Sans', system-ui, sans-serif; }
body, :not(input):not(textarea):not([contenteditable=true]) { cursor: default; }
button, a, select, input[type=checkbox], input[type=radio], input[type=submit], [role=button], [role=switch], label { cursor: pointer !important; user-select: none; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], input[type=number], textarea, [contenteditable=true] { cursor: text !important; }
/* Ensure primary variables fallback to dashboard primary */
:root { --color-primary: #3b82f6; --color-primary-hover: #2563eb; }
.dk-btn-primary { background-color: var(--color-primary, #3b82f6); color: #fff !important; }
.dk-btn-primary:hover { background-color: var(--color-primary-hover, #2563eb); }
</style>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
</head>
<body class="bg-gray-50 dark:bg-gray-950 text-gray-900 dark:text-gray-100 antialiased min-h-screen flex items-center justify-center p-4">
<div class="w-full max-w-md">
<div class="text-center mb-8">
{% if branding and branding.logo %}
<img src="{{ branding.logo.url }}" alt="{{ brand_name }}" class="h-12 w-auto mx-auto mb-4">
{% else %}
<div class="w-14 h-14 rounded-xl flex items-center justify-center text-white font-bold text-xl mx-auto mb-4" style="background-color: var(--color-primary, #3b82f6)">
{{ brand_name|first }}
</div>
{% endif %}
<h1 class="text-2xl font-bold text-gray-900 dark:text-white">{{ brand_name }}</h1>
<p class="text-gray-500 dark:text-gray-400 text-sm mt-1">Project Management</p>
</div>
<!-- Dashboard Themed Login Card -->
<div class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-2xl shadow-sm p-8">
<h2 class="text-lg font-semibold text-gray-900 dark:text-white mb-6">Sign in to your account</h2>
{% if form.errors %}
<div class="mb-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg text-sm text-red-600 dark:text-red-400 flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 shrink-0 text-red-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
</svg>
<span>Invalid username or password.</span>
</div>
{% endif %}
<form method="post" class="space-y-4">
{% csrf_token %}
<div>
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5">Username</label>
<input type="text" name="username" required autocomplete="username"
class="w-full px-4 py-2.5 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-950 text-gray-900 dark:text-white text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition-all duration-200">
</div>
<div x-data="{ showPassword: false }">
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5">Password</label>
<div class="relative">
<input :type="showPassword ? 'text' : 'password'" name="password" required autocomplete="current-password"
class="w-full pl-4 pr-10 py-2.5 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-950 text-gray-900 dark:text-white text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition-all duration-200">
<button type="button" @click="showPassword = !showPassword" class="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 focus:outline-none flex items-center justify-center p-1">
<i class="far text-sm" :class="showPassword ? 'fa-eye-slash' : 'fa-eye'"></i>
</button>
</div>
</div>
<button type="submit" class="w-full dk-btn dk-btn-primary py-2.5 rounded-lg text-sm font-semibold transition-all duration-200">
Sign In
</button>
</form>
<div class="relative my-6">
<div class="absolute inset-0 flex items-center"><div class="w-full border-t border-gray-200 dark:border-gray-800"></div></div>
<div class="relative flex justify-center"><span class="bg-white dark:bg-gray-900 px-3 text-xs text-gray-500">Or continue with</span></div>
</div>
<a href="/api/auth/google/"
class="w-full inline-flex items-center justify-center gap-3 px-4 py-2.5 border border-gray-200 dark:border-gray-700 rounded-lg text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-850 text-gray-700 dark:text-gray-300 transition-colors">
<svg class="w-5 h-5" viewBox="0 0 24 24"><path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"/><path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/><path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/><path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/></svg>
<span>Google</span>
</a>
</div>
<p class="text-center text-xs text-gray-400 mt-6 font-medium">&copy; {% now "Y" %} {{ copyright_name }}. All rights reserved.</p>
</div>
</body>
</html>