Finish the recovery guard only after the password change, mark the change in the repository so a late userUpdated event is harmless, keep the form locked after success, carry from through the reset check-email page, share the password error texts and focus the continue button. Refs #1 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
62 lines
2.3 KiB
Dart
62 lines
2.3 KiB
Dart
import 'package:go_router/go_router.dart';
|
|
import 'package:shuffle/core/routing/app_routes.dart';
|
|
import 'package:shuffle/features/auth/presentation/check_email/check_email_screen.dart';
|
|
import 'package:shuffle/features/auth/presentation/email_link/email_link_screen.dart';
|
|
import 'package:shuffle/features/auth/presentation/forgot_password/forgot_password_screen.dart';
|
|
import 'package:shuffle/features/auth/presentation/login/login_screen.dart';
|
|
import 'package:shuffle/features/auth/presentation/register/register_screen.dart';
|
|
import 'package:shuffle/features/auth/presentation/reset_password/reset_password_screen.dart';
|
|
|
|
/// Routes of the auth pages (Spec #1 § 5.3).
|
|
final List<RouteBase> authRoutes = [
|
|
GoRoute(
|
|
path: AppRoutes.login,
|
|
builder: (context, state) =>
|
|
LoginScreen(from: state.uri.queryParameters[AppRoutes.fromParam]),
|
|
),
|
|
GoRoute(
|
|
path: AppRoutes.register,
|
|
builder: (context, state) =>
|
|
RegisterScreen(from: state.uri.queryParameters[AppRoutes.fromParam]),
|
|
routes: [
|
|
GoRoute(
|
|
path: 'check-email',
|
|
builder: (context, state) {
|
|
// The address travels as `extra`, never in the URL. go_router would
|
|
// persist `extra` in the browser history; the router's
|
|
// `VolatileExtraCodec` prevents that. After a web reload it is gone;
|
|
// the screen then asks for it.
|
|
final extra = state.extra;
|
|
return CheckEmailScreen(email: extra is String ? extra : null);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
GoRoute(
|
|
path: AppRoutes.forgotPassword,
|
|
builder: (context, state) => ForgotPasswordScreen(
|
|
from: state.uri.queryParameters[AppRoutes.fromParam],
|
|
),
|
|
routes: [
|
|
GoRoute(
|
|
path: 'check-email',
|
|
// The mode is part of the path, so it survives a web reload.
|
|
builder: (context, state) => CheckEmailScreen(
|
|
mode: CheckEmailMode.reset,
|
|
from: state.uri.queryParameters[AppRoutes.fromParam],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
GoRoute(
|
|
path: AppRoutes.authConfirm,
|
|
builder: (context, state) => EmailLinkScreen(
|
|
tokenHash: state.uri.queryParameters['token_hash'],
|
|
type: state.uri.queryParameters['type'],
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: AppRoutes.resetPassword,
|
|
builder: (context, state) => const ResetPasswordScreen(),
|
|
),
|
|
];
|