Skip to content

Flag users with not strong passwords#575

Merged
tsubik merged 2 commits intodevelopfrom
feature/flag-weak-passwords
Mar 6, 2026
Merged

Flag users with not strong passwords#575
tsubik merged 2 commits intodevelopfrom
feature/flag-weak-passwords

Conversation

@tsubik
Copy link
Collaborator

@tsubik tsubik commented Feb 20, 2026

Flagging users with passwords that do not comply with current complexity rules.

JIRA: https://gfw.atlassian.net/browse/OPEN-371

@tsubik tsubik requested a review from santostiago February 20, 2026 18:53
@@ -0,0 +1,5 @@
class AddShouldChangePasswordToUsers < ActiveRecord::Migration[7.2]
def change
add_column :users, :should_change_password, :boolean, default: false, null: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it important to store this?
Isn't it enough to send them an email?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We have not decided yet how to inform them, maybe periodic email remainder would be good.

password = auth.env.dig("action_dispatch.request.parameters", "user", "password")
next unless password

user.update_column(:should_change_password, true) unless User.strong_password?(password)
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no way to move the should_change_password back to false.
If they should change password and then actually change it, this should go to false (it should be added on the model, not here, of course).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh, right. I will add this. Thanks

@tsubik tsubik force-pushed the feature/flag-weak-passwords branch from d3a856b to bdf3610 Compare March 6, 2026 10:08
@tsubik tsubik merged commit 443449a into develop Mar 6, 2026
4 checks passed
@tsubik tsubik deleted the feature/flag-weak-passwords branch March 6, 2026 10:30
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.

2 participants