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