Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(aws-android-sdk-auth-userpools): Check actual password requirements in drop-in UI #3588

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

mattcreaser
Copy link
Member

@mattcreaser mattcreaser commented Jun 6, 2024

Issue #, if available: #2370

Description of changes:
Don't hardcode the minimum password length to six. Instead, check the passwordProtectionSettings defined in awsconfiguration.json and use those for client-side validation.

Screenshot_20240605_153943

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mattcreaser mattcreaser requested a review from a team as a code owner June 6, 2024 12:09
Copy link
Contributor

@lawmicha lawmicha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if (username.isEmpty()) {
showError(getString(R.string.sign_up_username_missing));
return;
}

if (password.length() < 6) {
showError(getString(R.string.password_length_validation_failed));
if (minimumPasswordLength != null && password.length() < minimumPasswordLength) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when would minimum be null? Should we fall back to 6 as a safety? Is lower than 6 ever allowed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the password requirements are not specified in awsconfiguration this can be null.

6 is the minimum in Cognito, but if we don't know what the customer has set as their minimum then we just don't want to validate client-side, since any value we choose is likely to be wrong. The original customer report complains that validating with the wrong length leads to a confusing end user experience.

So if we don't know what the minimum is we'll just let the server side validate the password and display whatever error message they return if it's too short (this part is existing functionality).

@mattcreaser mattcreaser merged commit 54bc9b1 into main Jun 12, 2024
1 check passed
@mattcreaser mattcreaser deleted the mattcreaser/sign-in-ui branch June 12, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants