To_DO: ERROR AFTER LOGGING IN

This commit is contained in:
florianuhlig
2025-10-03 15:03:18 +02:00
parent 70c85cb8be
commit 1554723ed4
27 changed files with 1484 additions and 273 deletions

View File

@@ -1,119 +1,312 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Register</title>
<style>
/* Use the same styling as login.html for consistency */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;600&display=swap');
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Dashboard - ChatBot</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Inter', sans-serif;
}
body {
height: 100vh;
background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
body {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.login-container {
background: white;
max-width: 400px;
width: 100%;
padding: 40px 30px 50px;
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0,0,0,0.2);
text-align: center;
transition: transform 0.3s ease;
}
.dashboard-container {
max-width: 1200px;
margin: 0 auto;
}
.login-container:hover {
transform: translateY(-8px);
box-shadow: 0 30px 60px rgba(0,0,0,0.3);
}
.header {
background: white;
padding: 20px 30px;
border-radius: 15px;
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
margin-bottom: 30px;
display: flex;
justify-content: space-between;
align-items: center;
}
h2 {
font-weight: 600;
color: #333;
margin-bottom: 30px;
font-size: 28px;
letter-spacing: 1.2px;
}
.welcome-message {
color: #333;
}
.input-group {
margin-bottom: 25px;
text-align: left;
}
.welcome-message h1 {
font-size: 28px;
font-weight: 600;
margin-bottom: 5px;
}
label {
display: block;
margin-bottom: 8px;
color: #555;
font-weight: 600;
font-size: 14px;
}
input[type="username"],
input[type="email"],
input[type="password"] {
width: 100%;
padding: 14px 18px;
font-size: 16px;
border-radius: 12px;
border: 2px solid #ddd;
transition: 0.3s border-color ease;
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.welcome-message p {
color: #666;
font-size: 16px;
}
input[type="email"]:focus,
input[type="password"]:focus {
border-color: #2575fc;
outline: none;
box-shadow: 0 0 12px rgba(37, 117, 252, 0.5);
}
.user-actions {
display: flex;
gap: 15px;
align-items: center;
}
button {
width: 100%;
padding: 16px 0;
margin-top: 10px;
background-color: #2575fc;
border: none;
border-radius: 14px;
color: white;
font-size: 18px;
font-weight: 700;
letter-spacing: 1px;
cursor: pointer;
box-shadow: 0 10px 20px rgba(37, 117, 252, 0.4);
transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
.user-info {
background: #f8f9fa;
padding: 10px 15px;
border-radius: 10px;
font-size: 14px;
color: #555;
}
button:hover {
background-color: #1859d6;
box-shadow: 0 15px 25px rgba(24, 89, 214, 0.6);
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
text-decoration: none;
display: inline-block;
transition: all 0.3s ease;
}
.error-message {
margin-top: 20px;
color: #ff4d4f;
font-weight: 600;
font-size: 15px;
text-align: center;
background: #ffe6e6;
padding: 10px 15px;
border-radius: 10px;
box-shadow: 0 2px 6px rgba(255,77,79,0.3);
display: none;
}
</style>
.btn-primary {
background: #667eea;
color: white;
}
.btn-primary:hover {
background: #5a67d8;
transform: translateY(-1px);
}
.btn-secondary {
background: #e2e8f0;
color: #4a5568;
}
.btn-secondary:hover {
background: #cbd5e0;
}
.btn-danger {
background: #e53e3e;
color: white;
}
.btn-danger:hover {
background: #c53030;
transform: translateY(-1px);
}
.dashboard-content {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
margin-bottom: 30px;
}
.card {
background: white;
padding: 25px;
border-radius: 15px;
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
transition: transform 0.3s ease;
}
.card:hover {
transform: translateY(-5px);
}
.card h3 {
color: #333;
font-size: 20px;
font-weight: 600;
margin-bottom: 15px;
}
.card p {
color: #666;
line-height: 1.6;
margin-bottom: 15px;
}
.stats {
display: flex;
justify-content: space-between;
margin: 15px 0;
}
.stat-item {
text-align: center;
}
.stat-value {
font-size: 24px;
font-weight: 700;
color: #667eea;
}
.stat-label {
font-size: 12px;
color: #666;
text-transform: uppercase;
letter-spacing: 1px;
}
.alert {
padding: 15px 20px;
margin: 20px 0;
border-radius: 10px;
font-weight: 500;
}
.alert-success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.alert-error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.alert-warning {
background: #fff3cd;
color: #856404;
border: 1px solid #ffeaa7;
}
.alert-info {
background: #cce7ff;
color: #004085;
border: 1px solid #b8daff;
}
.quick-actions {
background: white;
padding: 25px;
border-radius: 15px;
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
grid-column: 1 / -1;
}
.quick-actions h3 {
margin-bottom: 20px;
color: #333;
}
.action-buttons {
display: flex;
gap: 15px;
flex-wrap: wrap;
}
@media (max-width: 768px) {
.header {
flex-direction: column;
gap: 20px;
text-align: center;
}
.user-actions {
flex-direction: column;
width: 100%;
}
.dashboard-content {
grid-template-columns: 1fr;
}
.action-buttons {
flex-direction: column;
}
}
</style>
</head>
<body>
<div class="dashboard-container">
<!-- Flash Messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ 'error' if category == 'error' else category }}">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<!-- Header -->
<div class="header">
<div class="welcome-message">
<h1>Welcome, {{ user.username }}! 👋</h1>
<p>Here's your ChatBot dashboard overview</p>
</div>
<div class="user-actions">
<div class="user-info">
Logged in as: <strong>{{ user.email }}</strong>
</div>
<a href="{{ url_for('profile') }}" class="btn btn-secondary">Profile</a>
<a href="{{ url_for('logout') }}" class="btn btn-danger"
onclick="return confirm('Are you sure you want to log out?')">
Logout
</a>
</div>
</div>
<!-- Dashboard Content -->
<div class="dashboard-content">
<div class="card">
<h3>Account Information</h3>
<p><strong>Username:</strong> {{ user.username }}</p>
<p><strong>Email:</strong> {{ user.email }}</p>
<p><strong>User ID:</strong> #{{ user.id }}</p>
<p><strong>Last Login:</strong> {{ dashboard_data.last_login[:19] if dashboard_data.last_login != 'Unknown' else 'Unknown' }}</p>
<a href="{{ url_for('change_password') }}" class="btn btn-primary">Change Password</a>
</div>
<div class="card">
<h3>Session Information</h3>
<p><strong>Session Status:</strong> Active</p>
<p><strong>Session Type:</strong> {{ 'Persistent' if session.permanent else 'Temporary' }}</p>
<p><strong>Expires:</strong> {{ dashboard_data.session_expires }}</p>
<div class="stats">
<div class="stat-item">
<div class="stat-value">{{ user.id }}</div>
<div class="stat-label">User ID</div>
</div>
</div>
</div>
<div class="card">
<h3>ChatBot Status</h3>
<p>Your personal chatbot is ready to help you.</p>
<p><strong>Status:</strong> <span style="color: #28a745;">Active</span></p>
<p><strong>Total Users:</strong> {{ dashboard_data.total_users }}</p>
<a href="#" class="btn btn-primary">Start Chat</a>
</div>
<!-- Quick Actions -->
<div class="quick-actions">
<h3>Quick Actions</h3>
<div class="action-buttons">
<a href="#" class="btn btn-primary">Start New Conversation</a>
<a href="{{ url_for('profile') }}" class="btn btn-secondary">View Profile</a>
<a href="{{ url_for('change_password') }}" class="btn btn-secondary">Change Password</a>
<a href="#" class="btn btn-secondary">Settings</a>
</div>
</div>
</div>
</div>
</body>
</html>
</html>

View File

@@ -1,141 +1,190 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Login</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;600&display=swap');
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Login - ChatBot</title>
<style>
/* Use your existing beautiful login CSS here */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;600&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
/* Your existing login styles... */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body {
height: 100vh;
background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
body {
height: 100vh;
background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.login-container {
background: white;
max-width: 400px;
width: 100%;
padding: 40px 30px 50px;
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0,0,0,0.2);
text-align: center;
transition: transform 0.3s ease;
}
.login-container {
background: white;
max-width: 400px;
width: 100%;
padding: 40px 30px 50px;
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0,0,0,0.2);
text-align: center;
transition: transform 0.3s ease;
}
.login-container:hover {
transform: translateY(-8px);
box-shadow: 0 30px 60px rgba(0,0,0,0.3);
}
.login-container:hover {
transform: translateY(-8px);
box-shadow: 0 30px 60px rgba(0,0,0,0.3);
}
h2 {
font-weight: 600;
color: #333;
margin-bottom: 30px;
font-size: 28px;
letter-spacing: 1.2px;
}
h2 {
font-weight: 600;
color: #333;
margin-bottom: 30px;
font-size: 28px;
letter-spacing: 1.2px;
}
.input-group {
margin-bottom: 25px;
text-align: left;
}
.input-group {
margin-bottom: 25px;
text-align: left;
}
label {
display: block;
margin-bottom: 8px;
color: #555;
font-weight: 600;
font-size: 14px;
}
label {
display: block;
margin-bottom: 8px;
color: #555;
font-weight: 600;
font-size: 14px;
}
input[type="email"],
input[type="password"] {
width: 100%;
padding: 14px 18px;
font-size: 16px;
border-radius: 12px;
border: 2px solid #ddd;
transition: 0.3s border-color ease;
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
input[type="email"],
input[type="password"] {
width: 100%;
padding: 14px 18px;
font-size: 16px;
border-radius: 12px;
border: 2px solid #ddd;
transition: 0.3s border-color ease;
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
input[type="email"]:focus,
input[type="password"]:focus {
border-color: #2575fc;
outline: none;
box-shadow: 0 0 12px rgba(37, 117, 252, 0.5);
}
input[type="email"]:focus,
input[type="password"]:focus {
border-color: #2575fc;
outline: none;
box-shadow: 0 0 12px rgba(37, 117, 252, 0.5);
}
button {
width: 100%;
padding: 16px 0;
margin-top: 10px;
background-color: #2575fc;
border: none;
border-radius: 14px;
color: white;
font-size: 18px;
font-weight: 700;
letter-spacing: 1px;
cursor: pointer;
box-shadow: 0 10px 20px rgba(37, 117, 252, 0.4);
transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
.checkbox-group {
display: flex;
align-items: center;
margin: 15px 0;
text-align: left;
}
button:hover {
background-color: #1859d6;
box-shadow: 0 15px 25px rgba(24, 89, 214, 0.6);
}
.checkbox-group input[type="checkbox"] {
margin-right: 8px;
}
.error-message {
margin-top: 20px;
color: #ff4d4f;
font-weight: 600;
font-size: 15px;
text-align: center;
background: #ffe6e6;
padding: 10px 15px;
border-radius: 10px;
box-shadow: 0 2px 6px rgba(255,77,79,0.3);
display: none;
}
</style>
.checkbox-group label {
margin: 0;
font-size: 14px;
color: #666;
}
button {
width: 100%;
padding: 16px 0;
margin-top: 10px;
background-color: #2575fc;
border: none;
border-radius: 14px;
color: white;
font-size: 18px;
font-weight: 700;
letter-spacing: 1px;
cursor: pointer;
box-shadow: 0 10px 20px rgba(37, 117, 252, 0.4);
transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
button:hover {
background-color: #1859d6;
box-shadow: 0 15px 25px rgba(24, 89, 214, 0.6);
}
.register-link {
margin-top: 20px;
font-size: 14px;
color: #666;
}
.register-link a {
color: #2575fc;
text-decoration: none;
font-weight: 600;
}
.register-link a:hover {
text-decoration: underline;
}
.error-message {
margin-top: 20px;
color: #ff4d4f;
font-weight: 600;
font-size: 15px;
text-align: center;
background: #ffe6e6;
padding: 10px 15px;
border-radius: 10px;
box-shadow: 0 2px 6px rgba(255,77,79,0.3);
display: none;
}
</style>
</head>
<body>
<div class="login-container">
<h2>Login to Your Account</h2>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="error-message" style="display: block;">
{% for category, message in messages %}
{{ message }}
{% endfor %}
</div>
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('login') }}">
<div class="input-group">
<label for="email">Email Address</label>
<input type="email" id="email" name="email" placeholder="you@example.com" required />
</div>
<div class="input-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" placeholder="Your password" required />
</div>
<button type="submit">Log In</button>
</form>
</div>
<div class="login-container">
<h2>Login to Your Account</h2>
<!-- Flash Messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="error-message" style="display: block;">
{% for category, message in messages %}
{{ message }}
{% endfor %}
</div>
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('login') }}">
<div class="input-group">
<label for="email">Email Address</label>
<input type="email" id="email" name="email"
placeholder="you@example.com"
value="{{ request.form.email if request.form.email }}"
required />
</div>
<div class="input-group">
<label for="password">Password</label>
<input type="password" id="password" name="password"
placeholder="Your password" required />
</div>
<div class="checkbox-group">
<input type="checkbox" id="remember_me" name="remember_me" />
<label for="remember_me">Remember me</label>
</div>
<button type="submit">Log In</button>
<div class="register-link">
Don't have an account? <a href="{{ url_for('register') }}">Sign up here</a>
</div>
</form>
</div>
</body>
</html>
</html>

View File

@@ -0,0 +1,155 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Profile - ChatBot</title>
<style>
/* Use similar styles as dashboard */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Inter', sans-serif;
}
body {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.profile-container {
max-width: 800px;
margin: 0 auto;
background: white;
border-radius: 15px;
box-shadow: 0 20px 40px rgba(0,0,0,0.1);
overflow: hidden;
}
.profile-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 40px;
text-align: center;
}
.profile-header h1 {
font-size: 36px;
margin-bottom: 10px;
}
.profile-header p {
font-size: 18px;
opacity: 0.9;
}
.profile-content {
padding: 40px;
}
.profile-info {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 30px;
margin-bottom: 30px;
}
.info-card {
background: #f8f9fa;
padding: 25px;
border-radius: 10px;
border-left: 4px solid #667eea;
}
.info-card h3 {
color: #333;
margin-bottom: 15px;
}
.info-card p {
color: #666;
margin-bottom: 10px;
}
.btn {
display: inline-block;
padding: 12px 24px;
background: #667eea;
color: white;
text-decoration: none;
border-radius: 8px;
font-weight: 500;
margin-right: 10px;
margin-bottom: 10px;
transition: all 0.3s ease;
}
.btn:hover {
background: #5a67d8;
transform: translateY(-2px);
}
.btn-secondary {
background: #e2e8f0;
color: #4a5568;
}
.btn-secondary:hover {
background: #cbd5e0;
}
.back-link {
margin-bottom: 20px;
}
.back-link a {
color: #667eea;
text-decoration: none;
font-weight: 500;
}
.back-link a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="profile-container">
<div class="profile-header">
<h1>{{ user.username }}</h1>
<p>User Profile</p>
</div>
<div class="profile-content">
<div class="back-link">
<a href="{{ url_for('dashboard') }}">&larr; Back to Dashboard</a>
</div>
<div class="profile-info">
<div class="info-card">
<h3>Account Details</h3>
<p><strong>User ID:</strong> #{{ user.id }}</p>
<p><strong>Username:</strong> {{ user.username }}</p>
<p><strong>Email:</strong> {{ user.email }}</p>
</div>
<div class="info-card">
<h3>Account Status</h3>
<p><strong>Status:</strong> <span style="color: #28a745;">Active</span></p>
<p><strong>Created:</strong> {{ user.created_at[:19] if user.created_at else 'Unknown' }}</p>
<p><strong>Last Updated:</strong> {{ user.updated_at[:19] if user.updated_at else 'Unknown' }}</p>
</div>
</div>
<div style="text-align: center; margin-top: 30px;">
<a href="{{ url_for('change_password') }}" class="btn">Change Password</a>
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">Back to Dashboard</a>
</div>
</div>
</div>
</body>
</html>