Shuffle/app/lib/features/auth/presentation/auth_routes.dart
cschlaefke dd91c078e0 feat(auth): add login screen with unconfirmed-account resend and safe redirect
KTO-01 Kriterien 5, 6 und 7 (01b): LoginController/State/Screen replace the
/login placeholder. Generic failure text for wrong email and password,
resend via ResendController (ResendOrigin.login), throttle and offline
banners, autofill hints, double-submit guard, validated from redirect.

Refs #1

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 09:00:53 +01:00

43 lines
1.7 KiB
Dart

import 'package:go_router/go_router.dart';
import 'package:shuffle/core/routing/app_routes.dart';
import 'package:shuffle/features/auth/presentation/auth_route_placeholder.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/login/login_screen.dart';
import 'package:shuffle/features/auth/presentation/register/register_screen.dart';
/// Routes of the auth pages (Spec #1 § 5.3). Forgot and reset password are
/// placeholders until 01c.
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) => const RegisterScreen(),
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);
},
),
],
),
authPlaceholderRoute(AppRoutes.forgotPassword, 'forgot_password'),
GoRoute(
path: AppRoutes.authConfirm,
builder: (context, state) => EmailLinkScreen(
tokenHash: state.uri.queryParameters['token_hash'],
type: state.uri.queryParameters['type'],
),
),
authPlaceholderRoute(AppRoutes.resetPassword, 'reset_password'),
];