| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Sign In - Agilisium Co-Lab</title> |
| <link rel="stylesheet" href="styles.css?v=2"> |
| <style> |
| |
| .login-container { |
| min-height: 100vh; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| background: linear-gradient(180deg, #E8F3EE 0%, #E3F0E7 60%, #DDEBE3 100%); |
| padding: 20px; |
| } |
| |
| .login-card { |
| background: #FFFFFF; |
| border-radius: 16px; |
| box-shadow: 0 20px 40px rgba(42, 110, 123, 0.1); |
| border: 1px solid #D9E6DF; |
| padding: 40px; |
| width: 100%; |
| max-width: 400px; |
| position: relative; |
| overflow: hidden; |
| } |
| |
| .login-card::before { |
| content: ''; |
| position: absolute; |
| top: 0; |
| left: 0; |
| right: 0; |
| height: 4px; |
| background: linear-gradient(90deg, #2A6E7B, #255F6A); |
| } |
| |
| .login-header { |
| text-align: center; |
| margin-bottom: 32px; |
| } |
| |
| .login-logo { |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| gap: 12px; |
| margin-bottom: 16px; |
| } |
| |
| .login-logo img { |
| width: 40px; |
| height: 40px; |
| } |
| |
| .login-title { |
| font-size: 28px; |
| font-weight: 700; |
| color: #0F4A46; |
| margin: 0; |
| } |
| |
| .login-subtitle { |
| color: #335A57; |
| font-size: 16px; |
| margin: 8px 0 0 0; |
| } |
| |
| .login-form { |
| display: flex; |
| flex-direction: column; |
| gap: 20px; |
| } |
| |
| .form-group { |
| display: flex; |
| flex-direction: column; |
| gap: 8px; |
| } |
| |
| .form-label { |
| font-weight: 600; |
| color: #374151; |
| font-size: 14px; |
| } |
| |
| .form-input { |
| padding: 12px 16px; |
| border: 2px solid #E5E7EB; |
| border-radius: 8px; |
| font-size: 16px; |
| transition: all 0.2s ease; |
| background: white; |
| } |
| |
| .form-input:focus { |
| outline: none; |
| border-color: #3B82F6; |
| box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); |
| } |
| |
| .form-input.error { |
| border-color: #EF4444; |
| } |
| |
| .remember-group { |
| display: flex; |
| align-items: center; |
| gap: 8px; |
| } |
| |
| .remember-checkbox { |
| width: 16px; |
| height: 16px; |
| accent-color: #3B82F6; |
| } |
| |
| .remember-label { |
| font-size: 14px; |
| color: #6B7280; |
| cursor: pointer; |
| } |
| |
| .login-buttons { |
| display: flex; |
| flex-direction: column; |
| gap: 12px; |
| } |
| |
| .btn-login { |
| background: linear-gradient(135deg, #3B82F6, #1D4ED8); |
| color: white; |
| border: none; |
| padding: 14px 24px; |
| border-radius: 8px; |
| font-size: 16px; |
| font-weight: 600; |
| cursor: pointer; |
| transition: all 0.2s ease; |
| position: relative; |
| overflow: hidden; |
| } |
| |
| .btn-login:hover:not(:disabled) { |
| transform: translateY(-1px); |
| box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3); |
| } |
| |
| .btn-login:disabled { |
| opacity: 0.6; |
| cursor: not-allowed; |
| } |
| |
| .btn-demo { |
| background: white; |
| color: #3B82F6; |
| border: 2px solid #3B82F6; |
| padding: 12px 24px; |
| border-radius: 8px; |
| font-size: 16px; |
| font-weight: 600; |
| cursor: pointer; |
| transition: all 0.2s ease; |
| } |
| |
| .btn-demo:hover { |
| background: #3B82F6; |
| color: white; |
| } |
| |
| .error-message { |
| color: #EF4444; |
| font-size: 14px; |
| margin-top: 4px; |
| display: none; |
| } |
| |
| .error-message.show { |
| display: block; |
| } |
| |
| .forgot-password { |
| text-align: center; |
| margin-top: 16px; |
| } |
| |
| .forgot-password a { |
| color: #6B7280; |
| text-decoration: none; |
| font-size: 14px; |
| transition: color 0.2s ease; |
| } |
| |
| .forgot-password a:hover { |
| color: #3B82F6; |
| } |
| |
| .back-to-home { |
| position: absolute; |
| top: 20px; |
| left: 20px; |
| color: white; |
| text-decoration: none; |
| font-weight: 500; |
| display: flex; |
| align-items: center; |
| gap: 8px; |
| transition: opacity 0.2s ease; |
| } |
| |
| .back-to-home:hover { |
| opacity: 0.8; |
| } |
| |
| .loading-spinner { |
| display: none; |
| width: 20px; |
| height: 20px; |
| border: 2px solid transparent; |
| border-top: 2px solid white; |
| border-radius: 50%; |
| animation: spin 1s linear infinite; |
| } |
| |
| @keyframes spin { |
| 0% { transform: rotate(0deg); } |
| 100% { transform: rotate(360deg); } |
| } |
| |
| @media (max-width: 480px) { |
| .login-card { |
| padding: 24px; |
| margin: 10px; |
| } |
| |
| .login-title { |
| font-size: 24px; |
| } |
| } |
| </style> |
| </head> |
| <body> |
| <a href="index.html" class="back-to-home"> |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| <path d="M19 12H5M12 19l-7-7 7-7"/> |
| </svg> |
| Back to Home |
| </a> |
|
|
| <div class="login-container"> |
| <div class="login-card"> |
| <div class="login-header"> |
| <div class="login-logo"> |
| <img src="newlogo.webp" alt="Agilisium Logo"> |
| <div> |
| <h1 class="login-title">Welcome Back</h1> |
| <p class="login-subtitle">Sign in to your account</p> |
| </div> |
| </div> |
| </div> |
|
|
| <form class="login-form" id="loginForm" novalidate> |
| <div class="form-group"> |
| <label for="email" class="form-label">Email Address</label> |
| <input |
| type="email" |
| id="email" |
| name="email" |
| class="form-input" |
| placeholder="Enter your email" |
| required |
| autocomplete="email" |
| > |
| <div id="email-error" class="error-message" role="alert"></div> |
| </div> |
|
|
| <div class="form-group"> |
| <label for="password" class="form-label">Password</label> |
| <input |
| type="password" |
| id="password" |
| name="password" |
| class="form-input" |
| placeholder="Enter your password" |
| required |
| autocomplete="current-password" |
| > |
| <div id="password-error" class="error-message" role="alert"></div> |
| </div> |
|
|
| <div class="remember-group"> |
| <input type="checkbox" id="remember" name="remember" class="remember-checkbox"> |
| <label for="remember" class="remember-label">Remember me for 7 days</label> |
| </div> |
|
|
| <div class="login-buttons"> |
| <button type="submit" class="btn-login" id="loginBtn"> |
| <span class="btn-text">Sign In</span> |
| <div class="loading-spinner"></div> |
| </button> |
| <button type="button" class="btn-demo" id="demoBtn"> |
| Login as Demo |
| </button> |
| </div> |
| </form> |
|
|
| <div class="forgot-password"> |
| <a href="#" id="forgotPasswordLink">Forgot your password?</a> |
| </div> |
| </div> |
| </div> |
|
|
| <script src="auth.js"></script> |
| <script> |
| |
| const loginForm = document.getElementById('loginForm'); |
| const emailInput = document.getElementById('email'); |
| const passwordInput = document.getElementById('password'); |
| const rememberCheckbox = document.getElementById('remember'); |
| const loginBtn = document.getElementById('loginBtn'); |
| const demoBtn = document.getElementById('demoBtn'); |
| const forgotPasswordLink = document.getElementById('forgotPasswordLink'); |
| |
| |
| const emailError = document.getElementById('email-error'); |
| const passwordError = document.getElementById('password-error'); |
| |
| |
| if (auth.isAuthenticated()) { |
| const user = auth.getUser(); |
| auth.showToast(`Welcome back, ${user.name}!`, 'success'); |
| window.location.href = 'index.html'; |
| } |
| |
| |
| loginForm.addEventListener('submit', async (e) => { |
| e.preventDefault(); |
| |
| |
| clearErrors(); |
| |
| |
| const email = emailInput.value.trim(); |
| const password = passwordInput.value; |
| const rememberMe = rememberCheckbox.checked; |
| |
| |
| if (!email) { |
| showError(emailInput, emailError, 'Email is required'); |
| return; |
| } |
| |
| if (!password) { |
| showError(passwordInput, passwordError, 'Password is required'); |
| return; |
| } |
| |
| |
| setLoading(true); |
| |
| try { |
| const result = await auth.login(email, password, rememberMe); |
| |
| if (result.success) { |
| auth.showToast(`Welcome back, ${result.user.name}!`, 'success'); |
| |
| |
| const urlParams = new URLSearchParams(window.location.search); |
| const redirectTo = urlParams.get('redirect') || 'index.html'; |
| window.location.href = redirectTo; |
| } else { |
| showError(passwordInput, passwordError, result.error || 'Login failed'); |
| } |
| } catch (error) { |
| showError(passwordInput, passwordError, 'An error occurred. Please try again.'); |
| } finally { |
| setLoading(false); |
| } |
| }); |
| |
| |
| demoBtn.addEventListener('click', async () => { |
| setLoading(true); |
| |
| try { |
| const result = await auth.loginAsDemo(); |
| |
| if (result.success) { |
| auth.showToast(`Welcome, ${result.user.name}!`, 'success'); |
| window.location.href = 'index.html'; |
| } else { |
| showError(passwordInput, passwordError, result.error || 'Demo login failed'); |
| } |
| } catch (error) { |
| showError(passwordInput, passwordError, 'An error occurred. Please try again.'); |
| } finally { |
| setLoading(false); |
| } |
| }); |
| |
| |
| forgotPasswordLink.addEventListener('click', (e) => { |
| e.preventDefault(); |
| alert('Demo environment: Password reset is disabled. Use the demo credentials to sign in.'); |
| }); |
| |
| |
| function showError(input, errorElement, message) { |
| input.classList.add('error'); |
| errorElement.textContent = message; |
| errorElement.classList.add('show'); |
| input.focus(); |
| } |
| |
| function clearErrors() { |
| [emailInput, passwordInput].forEach(input => { |
| input.classList.remove('error'); |
| }); |
| [emailError, passwordError].forEach(error => { |
| error.classList.remove('show'); |
| error.textContent = ''; |
| }); |
| } |
| |
| function setLoading(loading) { |
| const btnText = loginBtn.querySelector('.btn-text'); |
| const spinner = loginBtn.querySelector('.loading-spinner'); |
| |
| if (loading) { |
| loginBtn.disabled = true; |
| btnText.style.display = 'none'; |
| spinner.style.display = 'block'; |
| } else { |
| loginBtn.disabled = false; |
| btnText.style.display = 'block'; |
| spinner.style.display = 'none'; |
| } |
| } |
| |
| |
| emailInput.focus(); |
| </script> |
| <script src="chatbot-helper.js"></script> |
| </body> |
| </html> |
|
|