Skip to content

Commit dbd9eda

Browse files
committed
updated some data and speed
1 parent 7de72cb commit dbd9eda

7 files changed

Lines changed: 50 additions & 22 deletions

File tree

hackflow/blueprints/auth/routes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ def logout():
558558
user_name = session.get("full_name", "User")
559559
user_email = session.get("email")
560560
clear_current_user()
561-
session.clear()
562561
logger.info(f"User logged out: {user_email} (user_id: {user_id})")
563562
flash(f"Goodbye, {user_name}!", "info")
564563
return redirect(url_for("index"))

hackflow/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class ProductionConfig(Config):
110110
DEBUG = False
111111
WTF_CSRF_ENABLED = True
112112
SESSION_COOKIE_SECURE = True
113+
SESSION_COOKIE_SAMESITE = "None"
113114

114115
@classmethod
115116
def init_app(cls, app):

hackflow/decorators/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Custom decorators for authentication and authorization."""
22

33
from functools import wraps
4-
from flask import session, redirect, url_for, flash, abort, g
4+
from flask import session, redirect, url_for, flash, abort
55
from hackflow.services.auth_service import Role, Permission
66

77

@@ -123,8 +123,6 @@ def set_current_user(user_data: dict):
123123

124124
def clear_current_user():
125125
"""Clear current user from session."""
126-
session.pop("user_id", None)
127-
session.pop("email", None)
128-
session.pop("username", None)
129-
session.pop("role", None)
130-
session.pop("full_name", None)
126+
session_keys = ["user_id", "email", "username", "role", "full_name", "is_active"]
127+
for key in session_keys:
128+
session.pop(key, None)

hackflow/templates/auth/login.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,23 +250,23 @@ <h1>Welcome back</h1>
250250
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
251251

252252
<div class="form-group">
253-
<label class="form-label" for="email">Email address</label>
253+
<label class="form-label" for="email">Email address <span aria-hidden="true">*</span></label>
254254
<input type="email" class="form-control" id="email" name="email"
255-
placeholder="you@example.com" required autocomplete="email">
255+
placeholder="you@example.com" required autocomplete="email" aria-required="true">
256256
</div>
257257

258258
<div class="form-group">
259-
<label class="form-label" for="password">Password</label>
259+
<label class="form-label" for="password">Password <span aria-hidden="true">*</span></label>
260260
<input type="password" class="form-control" id="password" name="password"
261-
placeholder="Enter your password" required autocomplete="current-password">
261+
placeholder="Enter your password" required autocomplete="current-password" aria-required="true">
262262
</div>
263263

264264
<button type="submit" class="btn-primary">Sign In</button>
265265
</form>
266266

267267
<div class="divider"><span>or</span></div>
268268

269-
<a href="{{ url_for('auth.google_login') }}" class="google-btn">
269+
<a href="{{ url_for('auth.google_login') }}" class="google-btn" aria-label="Sign in with Google">
270270
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
271271
<path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" fill="#4285F4"/>
272272
<path 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" fill="#34A853"/>

hackflow/templates/auth/register.html

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,29 +251,32 @@ <h1>Create your account</h1>
251251
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
252252

253253
<div class="form-group">
254-
<label class="form-label" for="full_name">Full name</label>
254+
<label class="form-label" for="full_name">Full name <span aria-hidden="true">*</span></label>
255255
<input type="text" class="form-control" id="full_name" name="full_name"
256-
placeholder="John Doe" required>
256+
placeholder="John Doe" required aria-required="true">
257257
</div>
258258

259259
<div class="form-group">
260-
<label class="form-label" for="email">Email address</label>
260+
<label class="form-label" for="email">Email address <span aria-hidden="true">*</span></label>
261261
<input type="email" class="form-control" id="email" name="email"
262-
placeholder="you@example.com" required>
263-
<p class="form-hint">Use your college/organization email</p>
262+
placeholder="you@example.com" required aria-required="true"
263+
aria-describedby="email-hint">
264+
<p class="form-hint" id="email-hint">Use your college/organization email</p>
264265
</div>
265266

266267
<div class="form-row">
267268
<div class="form-group">
268-
<label class="form-label" for="password">Password</label>
269+
<label class="form-label" for="password">Password <span aria-hidden="true">*</span></label>
269270
<input type="password" class="form-control" id="password" name="password"
270-
placeholder="Min 8 characters" required minlength="8">
271+
placeholder="Min 8 characters" required minlength="8" aria-required="true"
272+
aria-describedby="password-hint">
273+
<p class="form-hint" id="password-hint">Minimum 8 characters</p>
271274
</div>
272275

273276
<div class="form-group">
274-
<label class="form-label" for="confirm_password">Confirm password</label>
277+
<label class="form-label" for="confirm_password">Confirm password <span aria-hidden="true">*</span></label>
275278
<input type="password" class="form-control" id="confirm_password" name="confirm_password"
276-
placeholder="Re-enter password" required minlength="8">
279+
placeholder="Re-enter password" required minlength="8" aria-required="true">
277280
</div>
278281
</div>
279282

hackflow/templates/auth/register_volunteer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ <h1>Join Our Team</h1>
283283
<div class="form-group">
284284
<label class="form-label" for="full_name">Full name <span class="required">*</span></label>
285285
<input type="text" class="form-control" id="full_name" name="full_name"
286-
placeholder="John Doe" required>
286+
placeholder="John Doe" required aria-required="true">
287287
</div>
288288

289289
<div class="form-group">

hackflow/templates/base.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@
2525
--warning: #d29922;
2626
--danger: #f85149;
2727
--text-primary: #f0f6fc;
28+
}
29+
30+
/* Skip link for accessibility */
31+
.skip-link {
32+
position: absolute;
33+
top: -40px;
34+
left: 0;
35+
background: var(--primary);
36+
color: var(--bg-deep);
37+
padding: 8px 16px;
38+
z-index: 9999;
39+
font-weight: 600;
40+
text-decoration: none;
41+
}
42+
43+
.skip-link:focus {
44+
top: 0;
45+
}
2846
--text-secondary: #8b949e;
2947
--text-muted: #6e7681;
3048
}
@@ -34,6 +52,14 @@
3452
color: var(--text-primary);
3553
min-height: 100vh;
3654
}
55+
/* Keyboard focus styles for accessibility */
56+
a:focus, button:focus, input:focus, select:focus, textarea:focus {
57+
outline: 2px solid var(--primary);
58+
outline-offset: 2px;
59+
}
60+
.btn:focus {
61+
box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.3);
62+
}
3763
.card-dark, .dashboard-section, .admin-section, .volunteer-section, .volunteer-card {
3864
background: var(--bg-surface);
3965
border: 1px solid var(--border);
@@ -46,6 +72,7 @@
4672
{% block extra_css %}{% endblock %}
4773
</head>
4874
<body>
75+
<a href="#main-content" class="skip-link">Skip to main content</a>
4976
{% if current_user %}
5077
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
5178
<div class="container-fluid">

0 commit comments

Comments
 (0)