From c5611aba247045f9d3a83d78c650aecff434592b Mon Sep 17 00:00:00 2001 From: Anil Singha <99383116+anilsingha-eGov@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:16:24 +0530 Subject: [PATCH] PFM-5983: Password length max set to 10, Fixed uppercase not giving hint --- .../change_password/change_password.dart | 3 +++ .../lib/utils/constants/i18_key_constants.dart | 3 +++ .../mgramseva/lib/widgets/password_hint.dart | 17 +++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/frontend/mgramseva/lib/screeens/change_password/change_password.dart b/frontend/mgramseva/lib/screeens/change_password/change_password.dart index ea786bedf..58f51b9ca 100644 --- a/frontend/mgramseva/lib/screeens/change_password/change_password.dart +++ b/frontend/mgramseva/lib/screeens/change_password/change_password.dart @@ -85,6 +85,7 @@ class _ChangePasswordState extends State { passwordDetails.currentpasswordCtrl, obscureText: true, isRequired: true, + maxLength: 10, maxLines: 1, onChange: (value) => saveInput(value), key: Keys.changePassword.CURRENT_PASSWORD_KEY, @@ -94,6 +95,7 @@ class _ChangePasswordState extends State { passwordDetails.newpasswordCtrl, obscureText: true, isRequired: true, + maxLength: 10, maxLines: 1, validator: (val) => Validators.passwordComparision( val, ApplicationLocalizations.of(context).translate(i18.password.NEW_PASSWORD_ENTER)), @@ -105,6 +107,7 @@ class _ChangePasswordState extends State { passwordDetails.confirmpasswordCtrl, obscureText: true, isRequired: true, + maxLength: 10, maxLines: 1, validator: (val) => Validators.passwordComparision( val, diff --git a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart index 27c7708d6..6fd9a90e6 100644 --- a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart +++ b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart @@ -261,6 +261,8 @@ class Password { 'CORE_PASS_HINT_ATLEAST_ONE_LETTER'; String get PASS_HINT_ATLEAST_ONE_NUMBER => 'CORE_PASS_HINT_ATLEAST_ONE_NUMBER'; + String get PASS_HINT_ATLEAST_ONE_UPPERCASE => + 'CORE_PASS_HINT_ATLEAST_ONE_UPPERCASE'; String get PASS_HINT_ATLEAST_ONE_SPECIAL_CHARACTER => 'CORE_PASS_HINT_ATLEAST_ONE_SPECIAL_CHARACTER'; String get ENTER_OTP_SENT_TO => 'ENTER_OTP_SENT_TO'; @@ -277,6 +279,7 @@ class Password { String get NEW_PASSWORD_ENTER => 'NEW_PASSWORD_ENTER'; String get CONFIRM_PASSWORD_ENTER => 'CONFIRM_PASSWORD_ENTER'; String get INVITED_TO_SINGLE_GP => 'INVITED_TO_SINGLE_GP'; + } class Expense { diff --git a/frontend/mgramseva/lib/widgets/password_hint.dart b/frontend/mgramseva/lib/widgets/password_hint.dart index 117cae20e..e38ec3256 100644 --- a/frontend/mgramseva/lib/widgets/password_hint.dart +++ b/frontend/mgramseva/lib/widgets/password_hint.dart @@ -97,6 +97,23 @@ class PasswordHint extends StatelessWidget { color: Colors.green[900], ) : Text("") + ]), + SizedBox(height: 5), + Row(children: [ + Text( + ApplicationLocalizations.of(context).translate(i18.password.PASS_HINT_ATLEAST_ONE_UPPERCASE), + style: TextStyle( + fontSize: 16, + color: RegExp(r'^(?=.*[A-Z])').hasMatch(inputPassword) + ? Colors.green[900] + : Theme.of(context).hintColor), + ), + new RegExp(r'^(?=.*[A-Z])').hasMatch(inputPassword) + ? Icon( + Icons.check, + color: Colors.green[900], + ) + : Text("") ]) ], )),