Skip to content

Commit 0208ee4

Browse files
committed
docs(auth): update route handler comments for context-aware flow
Updates the documentation comments for the `/request-code` and `/verify-code` route handlers. The new comments clearly explain the context-aware behavior driven by the `is_dashboard_login` request body flag, detailing the different logic for the user-facing app versus the dashboard.
1 parent 5b3125e commit 0208ee4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

routes/api/v1/auth/request-code.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import 'package:ht_shared/ht_shared.dart'; // For exceptions
66

77
/// Handles POST requests to `/api/v1/auth/request-code`.
88
///
9-
/// Initiates the email sign-in process by requesting a verification code
10-
/// be sent to the provided email address. It supports a context-aware flow
11-
/// for dashboard logins by checking for an `is_dashboard_login` flag in the
12-
/// request body. If this flag is true, the `AuthService` will perform
13-
/// additional checks to ensure the user exists and has the required
14-
/// permissions before sending a code.
9+
/// Initiates an email-based sign-in process. This endpoint is context-aware.
10+
///
11+
/// - For the user-facing app, it sends a verification code to the provided
12+
/// email, supporting both sign-in and sign-up.
13+
/// - For the dashboard, the request body must include `"is_dashboard_login": true`.
14+
/// In this mode, it first verifies the user exists and has 'admin' or
15+
/// 'publisher' roles before sending a code, effectively acting as a
16+
/// login-only gate.
1517
Future<Response> onRequest(RequestContext context) async {
1618
// Ensure this is a POST request
1719
if (context.request.method != HttpMethod.post) {

0 commit comments

Comments
 (0)