File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ Future<Response> onRequest(RequestContext context) async {
18
18
// Read the AuthService provided by middleware
19
19
final authService = context.read <AuthService >();
20
20
21
+ // Read the authenticated User from context (provided by authentication middleware)
22
+ // This user might be null (if not authenticated) or an anonymous user.
23
+ final authenticatedUser = context.read <User ?>();
24
+
21
25
// Parse the request body
22
26
final dynamic body;
23
27
try {
@@ -63,7 +67,12 @@ Future<Response> onRequest(RequestContext context) async {
63
67
64
68
try {
65
69
// Call the AuthService to handle the verification and sign-in logic
66
- final result = await authService.completeEmailSignIn (email, code);
70
+ // Pass the current authenticated user for potential data migration.
71
+ final result = await authService.completeEmailSignIn (
72
+ email,
73
+ code,
74
+ currentAuthUser: authenticatedUser,
75
+ );
67
76
68
77
// Create the specific payload containing user and token
69
78
final authPayload = AuthSuccessResponse (
You can’t perform that action at this time.
0 commit comments