forked from yaso_meth/mih-project
rset pass and business profile
This commit is contained in:
@@ -13,6 +13,7 @@ import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_authen
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_home.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_ai/mzansi_ai.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/mzansi_directory.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_business_profile.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/mzansi_profile.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/mzansi_profile_view.dart';
|
||||
@@ -68,11 +69,16 @@ class MihGoRouter {
|
||||
MihGoRouterPaths.mihAuthentication,
|
||||
MihGoRouterPaths.forgotPassword,
|
||||
MihGoRouterPaths.resetPassword,
|
||||
MihGoRouterPaths.aboutMih,
|
||||
];
|
||||
KenLogger.success(
|
||||
"Redirect Check: ${state.fullPath}, isUserSignedIn: $isUserSignedIn");
|
||||
if (!isUserSignedIn && !unauthenticatedPaths.contains(state.fullPath)) {
|
||||
return MihGoRouterPaths.mihAuthentication;
|
||||
}
|
||||
if (isUserSignedIn && unauthenticatedPaths.contains(state.fullPath)) {
|
||||
if (isUserSignedIn &&
|
||||
unauthenticatedPaths.contains(state.fullPath) &&
|
||||
state.fullPath != MihGoRouterPaths.aboutMih) {
|
||||
return MihGoRouterPaths.mihHome;
|
||||
}
|
||||
return null; // Stay on current route
|
||||
@@ -114,7 +120,9 @@ class MihGoRouter {
|
||||
name: "resetPassword",
|
||||
path: MihGoRouterPaths.resetPassword,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: resetPassword");
|
||||
String? token = state.uri.queryParameters['token'];
|
||||
KenLogger.success("token: $token");
|
||||
if (token == null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.go(MihGoRouterPaths.mihHome);
|
||||
@@ -188,6 +196,21 @@ class MihGoRouter {
|
||||
},
|
||||
),
|
||||
// ========================== Mzansi Profile Business ==================================
|
||||
GoRoute(
|
||||
name: "businessProfileManage",
|
||||
path: MihGoRouterPaths.businessProfileManage,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: businessProfileManage");
|
||||
final BusinessArguments? args = state.extra as BusinessArguments?;
|
||||
if (args == null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.go(MihGoRouterPaths.mihHome);
|
||||
});
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return MzansiBusinessProfile(arguments: args);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: "businessProfileView",
|
||||
path: MihGoRouterPaths.businessProfileView,
|
||||
@@ -388,15 +411,6 @@ class MihGoRouter {
|
||||
// return ProfileBusinessAdd(signedInUser: signedInUser!);
|
||||
// },
|
||||
// ),
|
||||
// GoRoute(
|
||||
// name: "businessProfileManage",
|
||||
// path: MihGoRouterPaths.businessProfileManage,
|
||||
// builder: (BuildContext context, GoRouterState state) {
|
||||
// KenLogger.success("MihGoRouter: businessProfileManage");
|
||||
// final BusinessArguments? args = state.extra as BusinessArguments?;
|
||||
// return MzansiBusinessProfile(arguments: args!);
|
||||
// },
|
||||
// ),
|
||||
// GoRoute(
|
||||
// name: "mihAuthentication",
|
||||
// path: MihGoRouterPaths.mihAuthentication,
|
||||
|
||||
@@ -81,10 +81,10 @@ class RouteGenerator {
|
||||
// as it avoids string hashing for each case. For a small number,
|
||||
// a switch is also fine.
|
||||
if (extPath == AppRoutes.resetPasswordExternal) {
|
||||
return MaterialPageRoute(
|
||||
settings: settings,
|
||||
builder: (_) => ResetPassword(token: Uri.base.queryParameters['token']),
|
||||
);
|
||||
// return MaterialPageRoute(
|
||||
// settings: settings,
|
||||
// builder: (_) => ResetPassword(token: Uri.base.queryParameters['token']),
|
||||
// );
|
||||
} else if (extPath == AppRoutes.privacyPolicyExternal) {
|
||||
return MaterialPageRoute(
|
||||
settings: settings,
|
||||
|
||||
@@ -20,7 +20,7 @@ import '../../mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||
import '../../mih_config/mih_env.dart';
|
||||
|
||||
class ResetPassword extends StatefulWidget {
|
||||
final String? token;
|
||||
final String token;
|
||||
const ResetPassword({
|
||||
super.key,
|
||||
required this.token,
|
||||
@@ -208,6 +208,16 @@ class _ResetPasswordState extends State<ResetPassword> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
widget.token,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
//logo
|
||||
Icon(
|
||||
Icons.lock,
|
||||
|
||||
@@ -155,113 +155,108 @@ class _MihResetPasswordState extends State<MihResetPassword> {
|
||||
}
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Center(
|
||||
child: SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
child: Padding(
|
||||
padding:
|
||||
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
|
||||
? EdgeInsets.symmetric(horizontal: width * 0.2)
|
||||
: EdgeInsets.symmetric(horizontal: width * 0.075),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
//logo
|
||||
Icon(
|
||||
Icons.lock,
|
||||
size: 100,
|
||||
child: SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
child: Padding(
|
||||
padding:
|
||||
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
|
||||
? EdgeInsets.symmetric(horizontal: width * 0.2)
|
||||
: EdgeInsets.symmetric(horizontal: width * 0.075),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("Token: ${widget.token}"), // For testing purposes only
|
||||
//logo
|
||||
Icon(
|
||||
Icons.lock,
|
||||
size: 100,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
//Heading
|
||||
Text(
|
||||
'Reset Password',
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
//Heading
|
||||
Text(
|
||||
'Reset Password',
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 25),
|
||||
MihForm(
|
||||
formKey: _formKey,
|
||||
formFields: [
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
controller: passwordController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
hintText: "Password",
|
||||
passwordMode: true,
|
||||
autofillHints: const [AutofillHints.password],
|
||||
validator: (value) {
|
||||
return MihValidationServices().validatePassword(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 25),
|
||||
MihForm(
|
||||
formKey: _formKey,
|
||||
formFields: [
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
controller: passwordController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
hintText: "Password",
|
||||
passwordMode: true,
|
||||
autofillHints: const [AutofillHints.password],
|
||||
validator: (value) {
|
||||
return MihValidationServices()
|
||||
.validatePassword(value);
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
controller: confirmPasswordController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
hintText: "Confirm Password",
|
||||
passwordMode: true,
|
||||
autofillHints: const [AutofillHints.password],
|
||||
validator: (value) {
|
||||
return MihValidationServices().validatePassword(value);
|
||||
},
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 25),
|
||||
// sign in button
|
||||
Center(
|
||||
child: MihButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
submitFormInput();
|
||||
} else {
|
||||
MihAlertServices().formNotFilledCompletely(context);
|
||||
}
|
||||
},
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
controller: confirmPasswordController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
hintText: "Confirm Password",
|
||||
passwordMode: true,
|
||||
autofillHints: const [AutofillHints.password],
|
||||
validator: (value) {
|
||||
return MihValidationServices()
|
||||
.validatePassword(value);
|
||||
},
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 25),
|
||||
// sign in button
|
||||
Center(
|
||||
child: MihButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
submitFormInput();
|
||||
} else {
|
||||
MihAlertServices()
|
||||
.formNotFilledCompletely(context);
|
||||
}
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Reset Password",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Reset Password",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_reviews.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart';
|
||||
@@ -66,7 +67,10 @@ class _MzansiBusinessProfileState extends State<MzansiBusinessProfile> {
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
iconSize: 35,
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: false,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tile.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||
@@ -24,10 +25,14 @@ class _MzansiBusinessProfileTileState extends State<MzansiBusinessProfileTile> {
|
||||
Widget build(BuildContext context) {
|
||||
return MihPackageTile(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
'/business-profile/manage',
|
||||
arguments: widget.arguments,
|
||||
context.goNamed(
|
||||
"businessProfileManage",
|
||||
extra: widget.arguments,
|
||||
);
|
||||
// Navigator.of(context).pushNamed(
|
||||
// '/business-profile/manage',
|
||||
// arguments: widget.arguments,
|
||||
// );
|
||||
},
|
||||
appName: "Business Profile",
|
||||
appIcon: Icon(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:country_code_picker/country_code_picker.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||
@@ -78,6 +79,7 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
||||
if (statusCode == 200) {
|
||||
bool successfullyUploadedFile = await uploadFile();
|
||||
if (successfullyUploadedFile) {
|
||||
//You left of here
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed(
|
||||
@@ -234,7 +236,7 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
||||
fullscreen: false,
|
||||
windowTitle: 'Edit Profile',
|
||||
onWindowTapClose: () {
|
||||
Navigator.of(context).pop();
|
||||
context.pop();
|
||||
resetControllers();
|
||||
},
|
||||
windowBody: MihSingleChildScroll(
|
||||
|
||||
Reference in New Issue
Block a user