From deb0a1d0b84e8f2b651db9ee25161f217f487839 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Mon, 18 Aug 2025 12:48:20 +0200 Subject: [PATCH] update Auth nav except Reset pass --- .../authentication/forgot_password.dart | 74 +++++++++++++++++-- .../package_tools/mih_sign_in.dart | 15 ++-- 2 files changed, 76 insertions(+), 13 deletions(-) diff --git a/Frontend/lib/mih_packages/authentication/forgot_password.dart b/Frontend/lib/mih_packages/authentication/forgot_password.dart index a6e6bb00..9801ceae 100644 --- a/Frontend/lib/mih_packages/authentication/forgot_password.dart +++ b/Frontend/lib/mih_packages/authentication/forgot_password.dart @@ -2,6 +2,8 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:go_router/go_router.dart'; +import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart'; import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart'; @@ -17,7 +19,6 @@ import '../../mih_components/mih_layout/mih_header.dart'; import '../../mih_components/mih_layout/mih_layout_builder.dart'; import '../../mih_components/mih_pop_up_messages/mih_error_message.dart'; import '../../mih_components/mih_pop_up_messages/mih_loading_circle.dart'; -import '../../mih_components/mih_pop_up_messages/mih_success_message.dart'; import '../../mih_config/mih_env.dart'; class ForgotPassword extends StatefulWidget { @@ -160,10 +161,62 @@ class _ForgotPasswordState extends State { showDialog( context: context, builder: (context) { - return const MIHSuccessMessage( - successType: "Success", - successMessage: - "We've sent a password reset link to your email address. Please check your inbox, including spam or junk folders.\n\nOnce you find the email, click on the link to reset your password.\n\nIf you don't receive the email within a few minutes, please try resending the reset request.\n\nThe reset link will expire after 2 hours"); + return MihPackageAlert( + alertIcon: Icon( + Icons.check_circle_outline_rounded, + size: 150, + color: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + ), + alertTitle: "Successfully Sent Reset Link", + alertBody: Column( + children: [ + Text( + "We've sent a password reset link to your email address. Please check your inbox, including spam or junk folders.\n\nOnce you find the email, click on the link to reset your password.\n\nIf you don't receive the email within a few minutes, please try resending the reset request.\n\nThe reset link will expire after 2 hours", + style: TextStyle( + color: MihColors.getSecondaryColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + fontSize: 15, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 25), + Center( + child: MihButton( + onPressed: () { + context.goNamed( + 'home', + extra: AuthArguments( + true, + true, + ), + ); + }, + buttonColor: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + elevation: 10, + width: 300, + child: Text( + "Dismiss", + style: TextStyle( + color: MihColors.getPrimaryColor( + MzansiInnovationHub.of(context)!.theme.mode == + "Dark"), + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + ) + ], + ), + alertColour: MihColors.getGreenColor( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + ); + // return const MIHSuccessMessage( + // successType: "Success", + // successMessage: + // "We've sent a password reset link to your email address. Please check your inbox, including spam or junk folders.\n\nOnce you find the email, click on the link to reset your password.\n\nIf you don't receive the email within a few minutes, please try resending the reset request.\n\nThe reset link will expire after 2 hours"); }, ); } @@ -179,7 +232,7 @@ class _ForgotPasswordState extends State { } else { await submitPasswodReset(); if (successfulForgotPassword) { - Navigator.of(context).pushNamedAndRemoveUntil('/', (route) => false); + // Navigator.of(context).pushNamedAndRemoveUntil('/', (route) => false); resetLinkSentSuccessfully(); } } @@ -190,7 +243,14 @@ class _ForgotPasswordState extends State { icon: const Icon(Icons.arrow_back), iconSize: 35, onTap: () { - Navigator.of(context).pop(); + // Navigator.of(context).pop(); + context.goNamed( + 'home', + extra: AuthArguments( + true, + true, + ), + ); }, ); } diff --git a/Frontend/lib/mih_packages/mih_authentication/package_tools/mih_sign_in.dart b/Frontend/lib/mih_packages/mih_authentication/package_tools/mih_sign_in.dart index e016fc4d..9b41df7e 100644 --- a/Frontend/lib/mih_packages/mih_authentication/package_tools/mih_sign_in.dart +++ b/Frontend/lib/mih_packages/mih_authentication/package_tools/mih_sign_in.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:go_router/go_router.dart'; import 'package:mzansi_innovation_hub/main.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_tile.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart'; @@ -59,10 +60,9 @@ class _MihSignInState extends State { void submitSignInForm() async { await signUserIn(); if (successfulSignIn) { - Navigator.of(context).pushNamedAndRemoveUntil( - '/', - (route) => false, - arguments: AuthArguments( + context.goNamed( + 'home', + extra: AuthArguments( true, true, ), @@ -324,8 +324,11 @@ class _MihSignInState extends State { children: [ GestureDetector( onTap: () { - Navigator.of(context).pushNamed( - '/forgot-password', + // Navigator.of(context).pushNamed( + // '/forgot-password', + // ); + context.goNamed( + 'forgotPassword', ); }, child: Text(