Skip to content

Enforce password validation rules on 'Forgot your password?' form#9090

Merged
ahukkanen merged 11 commits intodevelopfrom
fix/password-validator-on-forgot
Apr 8, 2022
Merged

Enforce password validation rules on 'Forgot your password?' form#9090
ahukkanen merged 11 commits intodevelopfrom
fix/password-validator-on-forgot

Conversation

@andreslucena
Copy link
Copy Markdown
Member

@andreslucena andreslucena commented Mar 24, 2022

🎩 What? Why?

Password validation rules didn't get enforced when a registered user reset their password through the "Forgot your password?" form (from Devise).

This PR fixes that.

I guess we could remove the validation from the forms:

validates :password, password: { name: :name, email: :email, username: :nickname }

validates :password, password: { name: :name, email: :email, username: :nickname }, if: -> { password.present? }

But before changing that, I want to see the specs if it fails some flows that don't need passwords (like Invitations)

(Never mind, we need that so the Forms validations work correctly. If not it gives an error without any detail on what exactly is the error)

📌 Related Issues

Testing

  1. Do the "Forgot your password?" flow until the password and confirmation screen
  2. Fill a password that doesn't follow the rules, for instance "1234567890"
  3. Save it
  4. See that it gives you a validation error

♥️ Thank you!

@andreslucena andreslucena added module: core type: fix PRs that implement a fix for a bug labels Mar 24, 2022
@andreslucena andreslucena requested a review from ahukkanen March 28, 2022 08:37
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Few small things I noticed. Otherwise this is great and works fine!

@andreslucena
Copy link
Copy Markdown
Member Author

Failing related specs, I need to check them

@andreslucena andreslucena marked this pull request as draft April 7, 2022 09:43
@andreslucena andreslucena marked this pull request as ready for review April 8, 2022 11:48
@andreslucena
Copy link
Copy Markdown
Member Author

This is ready to be reviewed again.

Just a comment, the only place that I know for sure that we're not enforcing the password validator is in system. My idea is to handle that in other PR after this is merged.

@ahukkanen ahukkanen merged commit e445131 into develop Apr 8, 2022
@ahukkanen ahukkanen deleted the fix/password-validator-on-forgot branch April 8, 2022 13:55
andreslucena added a commit that referenced this pull request May 6, 2022
)

* Enforce password validation rules on 'Forgot your password?' form

* Improve guard clause for organization

* Use a not common password for user factory

* Remove unecessary Devise password_length setting

* Change default common password in seeds

* Change default common password in specs

* Change default common password in specs

* Change domain in specs to example.org

* Change default common password in specs

* Fix organization guard clause as suggested in code review
ahukkanen pushed a commit that referenced this pull request May 10, 2022
) (#9245)

* Enforce password validation rules on 'Forgot your password?' form

* Improve guard clause for organization

* Use a not common password for user factory

* Remove unecessary Devise password_length setting

* Change default common password in seeds

* Change default common password in specs

* Change default common password in specs

* Change domain in specs to example.org

* Change default common password in specs

* Fix organization guard clause as suggested in code review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: core type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Password validation isn't enforced when resetting password

3 participants