From 8346d1a975139235b08c4c76b17788592b6ba3da Mon Sep 17 00:00:00 2001 From: noman2002 Date: Sun, 30 Jan 2022 19:44:25 +0530 Subject: [PATCH 1/6] added password validator for length of password --- lib/ui/views/authentication/signup_view.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ui/views/authentication/signup_view.dart b/lib/ui/views/authentication/signup_view.dart index d60c215a..84f27f3a 100644 --- a/lib/ui/views/authentication/signup_view.dart +++ b/lib/ui/views/authentication/signup_view.dart @@ -82,8 +82,14 @@ class _SignupViewState extends State { Widget _buildPasswordInput() { return CVPasswordField( focusNode: _emailFocusNode, - validator: (value) => - value?.isEmpty ?? true ? 'Password can\'t be empty' : null, + validator: (value) { + if (value!.isEmpty) { + return "Password cannot be empty"; + } else if (value.length < 6) { + return "Password length should be at least 6"; + } + return null; + }, onSaved: (value) => _password = value!.trim(), ); } From 9c868a6b3da1af7500822a9b948986d72c46c06a Mon Sep 17 00:00:00 2001 From: noman2002 Date: Sun, 30 Jan 2022 20:04:47 +0530 Subject: [PATCH 2/6] added test for password validator --- lib/ui/views/authentication/signup_view.dart | 2 +- test/ui_tests/authentication/signup_view_test.dart | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/ui/views/authentication/signup_view.dart b/lib/ui/views/authentication/signup_view.dart index 84f27f3a..4eb8cd4d 100644 --- a/lib/ui/views/authentication/signup_view.dart +++ b/lib/ui/views/authentication/signup_view.dart @@ -84,7 +84,7 @@ class _SignupViewState extends State { focusNode: _emailFocusNode, validator: (value) { if (value!.isEmpty) { - return "Password cannot be empty"; + return "Password can\'t be empty"; } else if (value.length < 6) { return "Password length should be at least 6"; } diff --git a/test/ui_tests/authentication/signup_view_test.dart b/test/ui_tests/authentication/signup_view_test.dart index 24f6a4e6..375cccdc 100644 --- a/test/ui_tests/authentication/signup_view_test.dart +++ b/test/ui_tests/authentication/signup_view_test.dart @@ -98,6 +98,17 @@ void main() { verifyNever(_usersApiMock.signup('test', 'test@test.com', '')); expect(find.text('Password can\'t be empty'), findsOneWidget); + + + await tester.enterText( + find.byWidgetPredicate((Widget widget) => + widget is CVPasswordField ), + 'abcd'); + await tester.tap(find.byType(CVPrimaryButton)); + await tester.pumpAndSettle(); + + verifyNever(_usersApiMock.signup('test', 'test@test.com', 'abcd')); + expect(find.text('Password length should be at least 6'), findsOneWidget); }); }); } From df57aa12b7a41372610356d3416e976bbff70afb Mon Sep 17 00:00:00 2001 From: noman2002 Date: Sun, 30 Jan 2022 21:14:23 +0530 Subject: [PATCH 3/6] formatted code --- test/ui_tests/authentication/signup_view_test.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/ui_tests/authentication/signup_view_test.dart b/test/ui_tests/authentication/signup_view_test.dart index 375cccdc..92245c8f 100644 --- a/test/ui_tests/authentication/signup_view_test.dart +++ b/test/ui_tests/authentication/signup_view_test.dart @@ -99,10 +99,8 @@ void main() { verifyNever(_usersApiMock.signup('test', 'test@test.com', '')); expect(find.text('Password can\'t be empty'), findsOneWidget); - await tester.enterText( - find.byWidgetPredicate((Widget widget) => - widget is CVPasswordField ), + find.byWidgetPredicate((Widget widget) => widget is CVPasswordField), 'abcd'); await tester.tap(find.byType(CVPrimaryButton)); await tester.pumpAndSettle(); From 405fbff698bbf1113e539a7856ec2731ac591f68 Mon Sep 17 00:00:00 2001 From: noman2002 Date: Mon, 31 Jan 2022 23:50:40 +0530 Subject: [PATCH 4/6] fixed flutter analyze --- lib/ui/views/authentication/signup_view.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/views/authentication/signup_view.dart b/lib/ui/views/authentication/signup_view.dart index 4eb8cd4d..2be4e2fc 100644 --- a/lib/ui/views/authentication/signup_view.dart +++ b/lib/ui/views/authentication/signup_view.dart @@ -84,7 +84,7 @@ class _SignupViewState extends State { focusNode: _emailFocusNode, validator: (value) { if (value!.isEmpty) { - return "Password can\'t be empty"; + return "Password can't be empty"; } else if (value.length < 6) { return "Password length should be at least 6"; } From 28b38e6d8caf785e0a04c509b72e42d8d7116c86 Mon Sep 17 00:00:00 2001 From: noman2002 Date: Sat, 5 Mar 2022 23:45:39 +0530 Subject: [PATCH 5/6] fixed deprecated api warning for flutter_facebook_auth --- pubspec.lock | 6 +++--- pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 4974483f..037c57ea 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -250,21 +250,21 @@ packages: name: flutter_facebook_auth url: "https://pub.dartlang.org" source: hosted - version: "3.5.7" + version: "4.1.1" flutter_facebook_auth_platform_interface: dependency: transitive description: name: flutter_facebook_auth_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.7.1" + version: "3.0.1" flutter_facebook_auth_web: dependency: transitive description: name: flutter_facebook_auth_web url: "https://pub.dartlang.org" source: hosted - version: "2.6.0+2" + version: "3.0.0+1" flutter_html: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 43ba92b9..f48092be 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: animations: ^2.0.0 cupertino_icons: ^1.0.3 datetime_picker_formfield: ^2.0.0 - flutter_facebook_auth: ^3.5.0 + flutter_facebook_auth: ^4.1.1 flutter_html: ^2.0.0 fluttericon: ^2.0.0 flutter_keyboard_visibility: ^5.0.2 From b408e2710850418ecffff9b43660da8ed88fb1ff Mon Sep 17 00:00:00 2001 From: noman2002 Date: Sat, 12 Mar 2022 17:25:51 +0530 Subject: [PATCH 6/6] Revert "fixed deprecated api warning for flutter_facebook_auth" This reverts commit 28b38e6d8caf785e0a04c509b72e42d8d7116c86. --- pubspec.lock | 6 +++--- pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 037c57ea..4974483f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -250,21 +250,21 @@ packages: name: flutter_facebook_auth url: "https://pub.dartlang.org" source: hosted - version: "4.1.1" + version: "3.5.7" flutter_facebook_auth_platform_interface: dependency: transitive description: name: flutter_facebook_auth_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "2.7.1" flutter_facebook_auth_web: dependency: transitive description: name: flutter_facebook_auth_web url: "https://pub.dartlang.org" source: hosted - version: "3.0.0+1" + version: "2.6.0+2" flutter_html: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index f48092be..43ba92b9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: animations: ^2.0.0 cupertino_icons: ^1.0.3 datetime_picker_formfield: ^2.0.0 - flutter_facebook_auth: ^4.1.1 + flutter_facebook_auth: ^3.5.0 flutter_html: ^2.0.0 fluttericon: ^2.0.0 flutter_keyboard_visibility: ^5.0.2