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

Per 9929 show password strength #494

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

crisnicandrei
Copy link
Contributor

This pull request displays the strength of a user's password when registering a new account.

Steps to test:

  1. Go to the register page
  2. Start inputting a password
  3. A message will appear below with the strength of it

This pr displays the strength of the password when the user registers a new account.
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 63.63636% with 8 lines in your changes missing coverage. Please review.

Project coverage is 42.75%. Comparing base (4e181f1) to head (19583af).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/app/auth/components/signup/signup.component.ts 63.63% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #494      +/-   ##
==========================================
+ Coverage   42.71%   42.75%   +0.04%     
==========================================
  Files         359      359              
  Lines       10974    10995      +21     
  Branches     1793     1796       +3     
==========================================
+ Hits         4687     4701      +14     
- Misses       6128     6136       +8     
+ Partials      159      158       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

waiting ||
signupForm.invalid ||
!agreedTerms ||
passwordStrengthMessage !== 'Strong'
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we want to block people from signing up just based on password strength. The intention is to show an indicator so that people can see their password strength and make their own decision on if they want to pick a stronger password.

Comment on lines +124 to +136
color: red;
}

.strength-weak {
color: orange;
}

.strength-medium {
color: blue;
}

.strength-strong {
color: green;
Copy link
Member

Choose a reason for hiding this comment

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

This is not an request for changes immediately but we probably want some design/accessibility review here for color choices that match Permanent's theme and also have proper contrast against the background.

const confirmPasswordControl = new UntypedFormControl('', [
Validators.required,
matchControlValidator(this.signupForm.controls['password']),
]);
this.signupForm.addControl('confirm', confirmPasswordControl);
}

ngOnInit(): void {
this.signupForm.controls['password'].valueChanges.subscribe((password) => {
Copy link
Member

Choose a reason for hiding this comment

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

Does this subscription get automatically cleaned up? It might, and I'd love confirmation that it does, but I feel like subscriptions have occasionally caused errors in the application once the things they refer to have been destroyed.

Comment on lines 53 to 54
passwordStrengthMessage: string = '';
passwordStrengthClass: string = '';
Copy link
Member

Choose a reason for hiding this comment

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

In theory we can make this typing even more specific with a type union. That way we know that Message can only ever be "Strong", "Weak", etc.

In this case it might be a bit redundant but it's nice to keep that in mind, especially when testing for string equality like we do in this component.

@crisnicandrei
Copy link
Contributor Author

@meisekimiu thanks! I will do the changes! @k8lyn6 can you please suggest some color values for the messages?

@k8lyn6
Copy link

k8lyn6 commented Dec 3, 2024

@crisnicandrei we can look at it tomorrow during our accessibility review. cc @yeslikesolo

@k8lyn6 k8lyn6 self-requested a review December 4, 2024 19:49
Copy link
Member

@meisekimiu meisekimiu left a comment

Choose a reason for hiding this comment

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

We've decided this probably needs more design work before it's ready to be released. We probably don't want to erase the work already done though, so can you hide this behind a feature flag, using the FeatureFlagService to test for its presence?

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