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 {
1818 // Read the AuthService provided by middleware
1919 final authService = context.read <AuthService >();
2020
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+
2125 // Parse the request body
2226 final dynamic body;
2327 try {
@@ -63,7 +67,12 @@ Future<Response> onRequest(RequestContext context) async {
6367
6468 try {
6569 // 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+ );
6776
6877 // Create the specific payload containing user and token
6978 final authPayload = AuthSuccessResponse (
You can’t perform that action at this time.
0 commit comments