talawa
talawa copied to clipboard
[Bug report] Inconsistencies in Password RegEx
Describe the bug when I'm signing myself for he app it says invalid password but doesn't say why, i looked in code there's a regex pattern it should follow. It will be helpful for user if shows u what's wrong with password for eg :- If i wrote my password as "Hello@123" Which is wrong it shouldn't have uppercase letter, and that it should show to the user. Currently it's just showing INVALID PASSWORD.
Expected behavior It should show user what's the issue in the password.
Actual behavior Right now its just showing "Invalid Password"
Can You assign it to me? Thanks
Congratulations on making your first Issue! :confetti_ball: If you haven't already, check out our Contributing Guidelines and Issue Reporting Guidelines to ensure that you are following our guidelines for contributing and making issues.
@M-A-D-A-R-A What was the password you used and what is the password the code expects? It's not clear from your issue.
First i tried with "N1234567" it said Invalid password , then i tried with "Nishant" it said "Invalid password " again, now for "ASDFGH" it accepted this password.
We should only allowing passwords with:
- A combination of upper and lower case letters;
- Special characters; and
- Numbers?
This should be stated in the change password screen and enforced.
The Written Regex right now is:-
r'^(?=.?[A-Z])(?=.?[a-z])(?=.?[0-9])(?=.?[!@#$&*~]).{8,}$
means
r'^
(?=.[A-Z]) // should contain at least one upper case
(?=.[a-z]) // should contain at least one lower case
(?=.?[0-9]) // should contain at least one digit
(?=.?[!@#$&*~]) // should contain at least one Special character
.{8,} // Must be at least 8 characters in length
$
So at the end all it shows is "invalid password" not show Why the password is invalid.
Is the regex in the change password
screen or the login
screen? The verification of the regex should only be done when the password is changed. @CyberWake, @sumitra19jha, @rutvik11062000, what could be the issue here?
The verification is done after the change. But yes, password validation throws an "Invalid Password" error message. It should be changed into, "Password must consist of at least one upper case letter and symbol"
Earlier we tend to use a package for the same this as @M-A-D-A-R-A stated to show at what parameters the password is not validating. After the migration process, we found the package to be nonnull safe plus it was having issues when writing some of the test cases. As far as the concern showed we may need to update the validation statement by checking on what grounds the regex failed.
@M-A-D-A-R-A if you wish to work on this one please feel free to ping in slack. We'll get this assigned to you.
I would like to work on this issue. @CyberWake
@M-A-D-A-R-A, I assigned this to @AvneetSingh2001 as you didn't respond to @CyberWake
@M-A-D-A-R-A, I assigned this to @AvneetSingh2001 as you didn't respond to @CyberWake
I already mentioned in the issue that can u assign it to me, also i told sumitra that I'm working on it but it's cool already assigned it to @AvneetSingh2001, no issues. Thanks
@M-A-D-A-R-A I didn't see your request in the original comment. I'll reassign it. I don't want to have your time wasted.
So Im trying to define a bool variable for checking every case.
final bool hasUppercase = password.contains(RegExp(r'^(?=.[A-Z])+$')); final bool hasDigits = password.contains( RegExp(r'^-?[0-9]+$')); final bool hasLowercase = password.contains(RegExp(r'^(?=.[a-z])+$')); final bool hasSpecialCharacters = password.contains( RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
but the bool is not returning any values?
I tried doing the same things as it was done for space regex. But the issue was still the same.
I don't know how to proceed further, any help will be appreciated. thanks.
@CyberWake @sumitra19jha Please take a look.
@CyberWake @sumitra19jha Please take a look.
It will be helpful if you could give a hint so that i can proceed further.
@sumitra19jha @CyberWake
So Im trying to define a bool variable for checking every case.
final bool hasUppercase = password.contains(RegExp(r'^(?=.[A-Z])+$')); final bool hasDigits = password.contains( RegExp(r'^-?[0-9]+$')); final bool hasLowercase = password.contains(RegExp(r'^(?=.[a-z])+$')); final bool hasSpecialCharacters = password.contains( RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
but the bool is not returning any values?
I tried doing the same things as it was done for space regex. But the issue was still the same.
I don't know how to proceed further, any help will be appreciated. thanks.
Please share the output of the error log file. What error is your console throwing?
So Im trying to define a bool variable for checking every case. final bool hasUppercase = password.contains(RegExp(r'^(?=.[A-Z])+$')); final bool hasDigits = password.contains( RegExp(r'^-?[0-9]+$')); final bool hasLowercase = password.contains(RegExp(r'^(?=.[a-z])+$')); final bool hasSpecialCharacters = password.contains( RegExp(r'[!@#$%^&*(),.?":{}|<>]')); but the bool is not returning any values? I tried doing the same things as it was done for space regex. But the issue was still the same. I don't know how to proceed further, any help will be appreciated. thanks.
Please share the output of the error log file. What error is your console throwing?
For the Following bools I'm getting these values.
I tried other Regex too but the values are same.
Is this issue fixed ? If not, I'd like to work on it. Otherwise please close it.