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

lib: Improve password fields #19220

Merged
merged 4 commits into from
Oct 31, 2023
Merged

Conversation

skobyda
Copy link
Contributor

@skobyda skobyda commented Aug 22, 2023

  • Adds show/hide feature
  • Adds a minimum to a progress bar
  • Changes width of a progress bar
  • Shows message indicating the strength of the password

Fixes #19199

Screencast.from.2023-08-22.14-30-21.webm

@skobyda
Copy link
Contributor Author

skobyda commented Aug 22, 2023

Currently we these 4 levels of messages for passwords "Weak password" < "Good password" < "Strong password" < "Excellent password".
I'm not sure about the wording of the "Good password". It has score more than 33 but less than 66 (and is shown in yellow color). It's a password which is neither good nor bad.
Maybe it should be "acceptable password"?
WDYT @garrett

@martinpitt
Copy link
Member

needsdesign → moving to draft

@martinpitt martinpitt marked this pull request as draft August 23, 2023 02:47
@garrett
Copy link
Member

garrett commented Sep 13, 2023

image

The contrast between the text and its background is not high enough. The color of the text should be the darker gold.

You can see this in PF demos:

image
https://www.patternfly.org/components/helper-text/html-demos/#helper-text-on-a-form

Here, you can see how PF uses brighter versions for icons, progress bars, etc. and the darker related color for text:

image
https://www.patternfly.org/components/alert/html/#alert-examples

Colors are specified here:

image
https://www.patternfly.org/design-foundations/colors/#primary-colors

  • icon: --pf-v5-global--warning-color--100
  • text: --pf-v5-global--warning-color--200

This isn't just a problem with the warning colors either, but it's most noticeable with it, as it has the least contrast. The other colors need to use the text variants too.

@garrett
Copy link
Member

garrett commented Sep 13, 2023

There's a strange intermediate step where the strength meter is shown in a blue state without text, right at the beginning of typing:

image

@garrett
Copy link
Member

garrett commented Sep 13, 2023

I'm not sure about the wording of the "Good password". It has score more than 33 but less than 66 (and is shown in yellow color). It's a password which is neither good nor bad.
Maybe it should be "acceptable password"?

Yes. 👍

@skobyda
Copy link
Contributor Author

skobyda commented Sep 18, 2023

Updated: Changed to the text color, got rid of the blue progress bar without any text and from now on using "Acceptable" instead of "Good" password:

Screenshot from 2023-09-18 14-02-44

@skobyda skobyda requested review from garrett and removed request for garrett September 18, 2023 12:03
Copy link
Member

@garrett garrett left a comment

Choose a reason for hiding this comment

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

It's a lot better. Thanks!

However, the meter (progress bar) doesn't update based on the strength.

Screencast.from.2023-09-20.09-59-43.webm

@skobyda skobyda force-pushed the passwordRedesign branch 3 times, most recently from 01d286c to 03c3b35 Compare October 16, 2023 12:58
@skobyda
Copy link
Contributor Author

skobyda commented Oct 17, 2023

Fixed the issue @garrett

Screencast.from.2023-10-17.15-06-03.webm

@skobyda skobyda requested a review from garrett October 17, 2023 13:06
garrett
garrett previously approved these changes Oct 26, 2023
Copy link
Member

@garrett garrett left a comment

Choose a reason for hiding this comment

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

This was waiting on the password meter fix. Thanks! Approved.

(But please move that line of CSS.)

Comment on lines 4 to 11
.ct-password-strength-meter {
grid-gap: var(--pf-v5-global--spacer--xs);

.pf-v5-c-progress__description, .pf-v5-c-progress__status {
display: none;
}

inline-size: var(--pf-v5-global--spacer--2xl);
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.ct-password-strength-meter {
grid-gap: var(--pf-v5-global--spacer--xs);
.pf-v5-c-progress__description, .pf-v5-c-progress__status {
display: none;
}
inline-size: var(--pf-v5-global--spacer--2xl);
}
.ct-password-strength-meter {
grid-gap: var(--pf-v5-global--spacer--xs);
inline-size: var(--pf-v5-global--spacer--2xl);
.pf-v5-c-progress__description, .pf-v5-c-progress__status {
display: none;
}
}

Parent CSS should be grouped together at the top. (This doesn't change anything, but it's better when it's not scattered.)

@skobyda
Copy link
Contributor Author

skobyda commented Oct 31, 2023

Ready for code-review

@skobyda skobyda marked this pull request as ready for review October 31, 2023 01:01
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Thanks! The code changes look good, but the committed pixel changes look like they revert #19520. I'll rebase this PR, fix the above two little issues, and re-do the pixel updates.

pkg/lib/cockpit-components-password.jsx Outdated Show resolved Hide resolved
pkg/lib/cockpit-components-password.jsx Show resolved Hide resolved
@martinpitt martinpitt added the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Oct 31, 2023
@martinpitt martinpitt removed the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Oct 31, 2023
@martinpitt
Copy link
Member

That looks much saner -- most tests are okay, just the accounts tests have the updated pixels for the reveal buttons. I'll push these.

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -77,20 +82,34 @@ export const PasswordFormFields = ({
setPasswordMessage(strength.message);
});
} else {
setPasswordStrength("");
setPasswordStrength();
Copy link
Contributor

Choose a reason for hiding this comment

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

This added line is not executed by any test. Details

@martinpitt martinpitt merged commit 2715d4d into cockpit-project:main Oct 31, 2023
91 of 93 checks passed
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.

Accounts: Improve password fields
4 participants