Skip to content

fix: admin password hint text#6906

Merged
zomars merged 11 commits intomainfrom
6842-cal-981-admin-password-change-has-incoherentobsolete-information
Feb 9, 2023
Merged

fix: admin password hint text#6906
zomars merged 11 commits intomainfrom
6842-cal-981-admin-password-change-has-incoherentobsolete-information

Conversation

@G3root
Copy link
Copy Markdown
Contributor

@G3root G3root commented Feb 6, 2023

What does this PR do?

Fixes #6842

to reproduce locally:

  • create a admin user with a password lesser than the required length of 15
  • try changing the password

issue:

Screencast.2023-02-07.08.21.45.webm

after:

Screencast.2023-02-07.07.25.36.webm

changes:

  • hide the banner after password is changed
  • fix the text in password hint

Environment: Staging(main branch) / Production

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@G3root G3root linked an issue Feb 6, 2023 that may be closed by this pull request
@linear
Copy link
Copy Markdown

linear bot commented Feb 6, 2023

CAL-981 Admin password change has incoherent/obsolete information

image.png

There are two issues with this:

  1. The alert says minimum of 15 characters are required, but the description in the body says 7 characters, thus the information being invalid
  2. Once the password is changed, the alert persists despite now the user having minimum 15 character password

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
cal ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 9, 2023 at 1:55AM (UTC)
1 Ignored Deployment
Name Status Preview Comments Updated
ui ⬜️ Ignored (Inspect) Feb 9, 2023 at 1:55AM (UTC)

"password_hint_admin_min": "Minimum 15 characters long",
"password_hint_num": "Contain at least 1 number",
"invalid_password_hint": "The password must be a minimum of 7 characters long containing at least one number and have a mixture of uppercase and lowercase letters",
"invalid_password_hint": "The password must be a minimum of 15 characters long containing at least one number and have a mixture of uppercase and lowercase letters",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the 15 character minimum limit is only for the admin role. for other 7 characters are still allowed. maybe just check if the user role is admin then show the 15 character password hint else 7 chars.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i'll update those changes 🙌🏼 . do we still have the number, uppercase and uppercase requirement for a normal user ?

Copy link
Copy Markdown
Contributor Author

@G3root G3root Feb 7, 2023

Choose a reason for hiding this comment

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

i'm planning on to convert the hardcoded number into a template variable.

Copy link
Copy Markdown
Contributor

@Udit-takkar Udit-takkar Feb 7, 2023

Choose a reason for hiding this comment

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

check lib/auth

export function validPassword(password: string) {
  if (password.length < 7) return false;

  if (!/[A-Z]/.test(password) || !/[a-z]/.test(password)) return false;

  if (!/\d+/.test(password)) return false;

  return true;
}

Copy link
Copy Markdown
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

can we improve the UX here ? if new password does not meet the requirements then message/input box should be in red.

Screenshot 2023-02-07 at 8 32 06 AM

@leog
Copy link
Copy Markdown
Contributor

leog commented Feb 7, 2023

can we improve the UX here ? if new password does not meet the requirements then message/input box should be in red.

I agree with @Udit-takkar, perhaps you can use the same hints shown when signing-up in website here: https://cal.com/signup. It is based on zod and uses our custom inputs to digest them. Happy to help there, I implemented it.

@G3root
Copy link
Copy Markdown
Contributor Author

G3root commented Feb 7, 2023

pushed some changes:

  • used alert component for errors returned by the server.
  • added client side validation for new password and error messages
  • fix some inconsitencies in i18n
Screencast.2023-02-07.22.52.25.webm

cc: @Udit-takkar @leog

Copy link
Copy Markdown
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

some issue with password validation(this should be a valid password). This is also the reason why e2e tests are failing. everything else is fine 👍

Screenshot 2023-02-08 at 12 49 12 PM

@github-actions github-actions bot added ❗️ .env changes contains changes to env variables ❗️ migrations contains migration files labels Feb 9, 2023
Copy link
Copy Markdown
Contributor

@zomars zomars left a comment

Choose a reason for hiding this comment

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

Nice work @G3root 🙏🏽

Ship it

@zomars zomars enabled auto-merge (squash) February 9, 2023 01:09
@G3root G3root force-pushed the 6842-cal-981-admin-password-change-has-incoherentobsolete-information branch from 45329e7 to 8960def Compare February 9, 2023 01:28
@G3root G3root removed ❗️ migrations contains migration files ❗️ .env changes contains changes to env variables labels Feb 9, 2023
@G3root
Copy link
Copy Markdown
Contributor Author

G3root commented Feb 9, 2023

@Udit-takkar pushed a fix for the regex

Screencast.2023-02-09.07.20.41.webm

@G3root G3root requested a review from Udit-takkar February 9, 2023 01:52
@zomars zomars merged commit 156f3e5 into main Feb 9, 2023
@zomars zomars deleted the 6842-cal-981-admin-password-change-has-incoherentobsolete-information branch February 9, 2023 02:02
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.

[CAL-981] Admin password change has incoherent/obsolete information

4 participants