From 50ef283b520b1f48391f112d7ac1e8a849eb965b Mon Sep 17 00:00:00 2001 From: mohammad Date: Wed, 21 Aug 2024 09:22:31 +0300 Subject: [PATCH] password expired. --- .../access_management/bloc/access_bloc.dart | 2 +- .../view/access_management.dart | 2 +- lib/pages/auth/bloc/auth_bloc.dart | 5 ++++- .../view/add_device_dialog.dart | 6 +++++- .../visitor_password/view/repeat_widget.dart | 18 +++++++++--------- .../view/visitor_password_dialog.dart | 6 +++++- lib/utils/color_manager.dart | 2 +- 7 files changed, 26 insertions(+), 15 deletions(-) diff --git a/lib/pages/access_management/bloc/access_bloc.dart b/lib/pages/access_management/bloc/access_bloc.dart index 7c57bfa4..f586c56f 100644 --- a/lib/pages/access_management/bloc/access_bloc.dart +++ b/lib/pages/access_management/bloc/access_bloc.dart @@ -133,7 +133,7 @@ class AccessBloc extends Bloc { // Check if the password name should be used for filtering if (event.passwordName != null && event.passwordName!.isNotEmpty) { final bool matchesName = item.passwodName != null && - item.passwodName.contains(event.passwordName!); + item.passwodName.contains(event.passwordName); if (!matchesName) { matchesCriteria = false; } diff --git a/lib/pages/access_management/view/access_management.dart b/lib/pages/access_management/view/access_management.dart index 55570324..e2f79429 100644 --- a/lib/pages/access_management/view/access_management.dart +++ b/lib/pages/access_management/view/access_management.dart @@ -151,7 +151,7 @@ class AccessManagementPage extends StatelessWidget { child: DefaultButton( onPressed: () { accessBloc.add(FilterDataEvent( - passwordName: accessBloc.passwordName.text, + passwordName: accessBloc.passwordName.text.toLowerCase(), startTime: accessBloc.effectiveTimeTimeStamp, endTime: accessBloc.expirationTimeTimeStamp )); diff --git a/lib/pages/auth/bloc/auth_bloc.dart b/lib/pages/auth/bloc/auth_bloc.dart index bfd42eaf..2cc1a033 100644 --- a/lib/pages/auth/bloc/auth_bloc.dart +++ b/lib/pages/auth/bloc/auth_bloc.dart @@ -85,6 +85,9 @@ class AuthBloc extends Bloc { } else if (response == "You entered wrong otp") { forgetValidate = 'Wrong one time password.'; emit(AuthInitialState()); + }else if (response == "OTP expired") { + forgetValidate = 'One time password has been expired.'; + emit(AuthInitialState()); } } catch (failure) { // forgetValidate='Invalid Credentials!'; @@ -92,7 +95,7 @@ class AuthBloc extends Bloc { // emit(FailureForgetState(error: failure.toString())); } } - +//925207 String? validateCode(String? value) { if (value == null || value.isEmpty) { return 'Code is required'; diff --git a/lib/pages/visitor_password/view/add_device_dialog.dart b/lib/pages/visitor_password/view/add_device_dialog.dart index 58e49182..7dc5407d 100644 --- a/lib/pages/visitor_password/view/add_device_dialog.dart +++ b/lib/pages/visitor_password/view/add_device_dialog.dart @@ -25,7 +25,11 @@ class AddDeviceDialog extends StatelessWidget { final visitorBloc = BlocProvider.of(context); return AlertDialog( backgroundColor: Colors.white, - title: const Text('Add Accessible Device'), + title: Text('Add Accessible Device', + style: Theme.of(context).textTheme.headlineLarge!.copyWith( + fontWeight: FontWeight.w400, + fontSize: 24, + color: Colors.black),), content: Container( height: MediaQuery.of(context).size.height/1.7, width: MediaQuery.of(context).size.width/2, diff --git a/lib/pages/visitor_password/view/repeat_widget.dart b/lib/pages/visitor_password/view/repeat_widget.dart index ecbd2b89..b04614fe 100644 --- a/lib/pages/visitor_password/view/repeat_widget.dart +++ b/lib/pages/visitor_password/view/repeat_widget.dart @@ -17,7 +17,7 @@ class RepeatWidget extends StatelessWidget { return BlocBuilder( builder: (context, state) { - final smartDoorBloc = BlocProvider.of(context); + final visitorBloc = BlocProvider.of(context); return Column( children: [ Container( @@ -25,7 +25,7 @@ class RepeatWidget extends StatelessWidget { height: size.height * 0.06, // Adjust height as needed child: ListView( scrollDirection: Axis.horizontal, - children: smartDoorBloc.days.map((day) { + children: visitorBloc.days.map((day) { return Container( width: size.width* 0.09, child: CheckboxListTile( @@ -33,15 +33,15 @@ class RepeatWidget extends StatelessWidget { day['day']!, style: TextStyle( fontSize: 18, - color: smartDoorBloc.selectedDays.contains(day['key']) + color: visitorBloc.selectedDays.contains(day['key']) ? Colors.black : ColorsManager.grayColor, ), ), - value: smartDoorBloc.selectedDays.contains(day['key']), + value: visitorBloc.selectedDays.contains(day['key']), onChanged: (bool? value) { if (value != null) { - smartDoorBloc.add(ToggleDaySelectionEvent(key: day['key']!)); + visitorBloc.add(ToggleDaySelectionEvent(key: day['key']!)); } }, ), @@ -56,19 +56,19 @@ class RepeatWidget extends StatelessWidget { title: '', size: size, endTime: () { - smartDoorBloc.add(SelectTimeVisitorPassword( + visitorBloc.add(SelectTimeVisitorPassword( isRepeat: true, context: context, isStart: false )); }, startTime: () { - smartDoorBloc.add(SelectTimeVisitorPassword( + visitorBloc.add(SelectTimeVisitorPassword( isRepeat: true, context: context, isStart: true )); }, - firstString: smartDoorBloc.repeatStartTime.toString(), - secondString: smartDoorBloc.repeatEndTime.toString(), + firstString: visitorBloc.repeatStartTime.toString(), + secondString: visitorBloc.repeatEndTime.toString(), ), ), diff --git a/lib/pages/visitor_password/view/visitor_password_dialog.dart b/lib/pages/visitor_password/view/visitor_password_dialog.dart index eadee6dc..e91ab834 100644 --- a/lib/pages/visitor_password/view/visitor_password_dialog.dart +++ b/lib/pages/visitor_password/view/visitor_password_dialog.dart @@ -26,7 +26,11 @@ class VisitorPasswordDialog extends StatelessWidget { bool isRepeat = state is IsRepeatState ? state.repeat : visitorBloc.repeat; return AlertDialog( backgroundColor: Colors.white, - title: const Text('Create visitor password'), + title: Text('Create visitor password', + style: Theme.of(context).textTheme.headlineLarge!.copyWith( + fontWeight: FontWeight.w400, + fontSize: 24, + color: Colors.black),), content: SingleChildScrollView( child: Form( key: visitorBloc.forgetFormKey, diff --git a/lib/utils/color_manager.dart b/lib/utils/color_manager.dart index 9b5b6d44..2ee12718 100644 --- a/lib/utils/color_manager.dart +++ b/lib/utils/color_manager.dart @@ -25,7 +25,7 @@ abstract class ColorsManager { static const Color blackColor = Color(0xFF000000); static const Color lightGreen = Color(0xFF00FF0A); static const Color grayColor = Color(0xFF999999); - static const Color red = Colors.red; + static const Color red = Color(0xFFFF0000); static const Color graysColor = Color(0xffEBEBEB); static const Color textGray = Color(0xffD5D5D5); static const Color btnColor = Color(0xFF00008B);