Files
ChatBot/frontend/templates/change_password.html
2025-10-04 23:35:23 +02:00

358 lines
10 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Change Password - 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: 'Inter', sans-serif;
}
body {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.change-password-container {
background: white;
max-width: 500px;
width: 100%;
padding: 40px;
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0,0,0,0.2);
transition: transform 0.3s ease;
}
.change-password-container:hover {
transform: translateY(-5px);
box-shadow: 0 30px 60px rgba(0,0,0,0.3);
}
.header {
text-align: center;
margin-bottom: 30px;
}
.header h1 {
color: #333;
font-size: 28px;
font-weight: 600;
margin-bottom: 10px;
}
.header p {
color: #666;
font-size: 16px;
}
.back-link {
margin-bottom: 20px;
}
.back-link a {
color: #667eea;
text-decoration: none;
font-weight: 500;
display: inline-flex;
align-items: center;
gap: 5px;
}
.back-link a:hover {
text-decoration: underline;
}
.input-group {
margin-bottom: 25px;
}
label {
display: block;
margin-bottom: 8px;
color: #555;
font-weight: 600;
font-size: 14px;
}
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="password"]:focus {
border-color: #667eea;
outline: none;
box-shadow: 0 0 12px rgba(102, 126, 234, 0.3);
}
.password-requirements {
background: #f8f9fa;
padding: 15px;
border-radius: 8px;
margin-bottom: 25px;
font-size: 14px;
}
.password-requirements h4 {
color: #333;
margin-bottom: 10px;
font-size: 14px;
font-weight: 600;
}
.requirements-list {
list-style: none;
padding: 0;
}
.requirements-list li {
color: #666;
margin-bottom: 5px;
padding-left: 20px;
position: relative;
}
.requirements-list li:before {
content: "•";
color: #667eea;
font-weight: bold;
position: absolute;
left: 0;
}
.btn {
width: 100%;
padding: 16px 0;
border: none;
border-radius: 12px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
text-decoration: none;
display: inline-block;
text-align: center;
margin-bottom: 10px;
}
.btn-primary {
background: #667eea;
color: white;
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}
.btn-primary:hover {
background: #5a67d8;
box-shadow: 0 15px 25px rgba(90, 103, 216, 0.4);
transform: translateY(-1px);
}
.btn-secondary {
background: #e2e8f0;
color: #4a5568;
border: 1px solid #cbd5e0;
}
.btn-secondary:hover {
background: #cbd5e0;
transform: translateY(-1px);
}
.alert {
padding: 15px 20px;
margin-bottom: 25px;
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;
}
.security-notice {
background: #e6f3ff;
border: 1px solid #b8daff;
padding: 15px;
border-radius: 8px;
margin-bottom: 25px;
font-size: 14px;
color: #004085;
}
.security-notice h4 {
margin-bottom: 8px;
font-size: 14px;
font-weight: 600;
}
.form-actions {
display: flex;
gap: 15px;
margin-top: 30px;
}
.form-actions .btn {
width: auto;
flex: 1;
margin-bottom: 0;
}
@media (max-width: 600px) {
.change-password-container {
margin: 10px;
padding: 30px 20px;
}
.form-actions {
flex-direction: column;
}
.form-actions .btn {
width: 100%;
}
}
</style>
</head>
<body>
<div class="change-password-container">
<div class="back-link">
<a href="{{ url_for('dashboard') }}">← Back to Dashboard</a>
</div>
<div class="header">
<h1>Change Password</h1>
<p>Update your account password</p>
</div>
<!-- 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 %}
<div class="security-notice">
<h4>🔒 Security Notice</h4>
<p>For your security, we require your current password to make changes. Your new password will be encrypted and stored securely.</p>
</div>
<form method="POST" action="{{ url_for('change_password') }}">
<div class="input-group">
<label for="current_password">Current Password</label>
<input type="password" id="current_password" name="current_password"
placeholder="Enter your current password"
required autocomplete="current-password" />
</div>
<div class="input-group">
<label for="new_password">New Password</label>
<input type="password" id="new_password" name="new_password"
placeholder="Enter your new password"
required autocomplete="new-password" />
</div>
<div class="input-group">
<label for="confirm_password">Confirm New Password</label>
<input type="password" id="confirm_password" name="confirm_password"
placeholder="Confirm your new password"
required autocomplete="new-password" />
</div>
<div class="password-requirements">
<h4>Password Requirements:</h4>
<ul class="requirements-list">
<li>At least 8 characters long</li>
<li>Contains at least one uppercase letter (A-Z)</li>
<li>Contains at least one lowercase letter (a-z)</li>
<li>Contains at least one number (0-9)</li>
<li>Contains at least one special character (!@#$%^&*)</li>
</ul>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">
Update Password
</button>
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">
Cancel
</a>
</div>
</form>
</div>
<script>
// Simple client-side validation for better UX
document.addEventListener('DOMContentLoaded', function() {
const form = document.querySelector('form');
const newPassword = document.getElementById('new_password');
const confirmPassword = document.getElementById('confirm_password');
form.addEventListener('submit', function(e) {
if (newPassword.value !== confirmPassword.value) {
e.preventDefault();
alert('New passwords do not match!');
confirmPassword.focus();
return false;
}
if (newPassword.value.length < 8) {
e.preventDefault();
alert('Password must be at least 8 characters long!');
newPassword.focus();
return false;
}
});
// Real-time password confirmation check
confirmPassword.addEventListener('input', function() {
if (this.value && this.value !== newPassword.value) {
this.style.borderColor = '#e53e3e';
} else if (this.value && this.value === newPassword.value) {
this.style.borderColor = '#38a169';
} else {
this.style.borderColor = '#ddd';
}
});
});
</script>
</body>
</html>