Skip to content

Conversation

@sampoder
Copy link
Member

Closes #12419. Also adds a test for this!

@sampoder sampoder requested a review from a team December 22, 2025 05:13
Copy link
Contributor

@YodaLightsabr YodaLightsabr left a comment

Choose a reason for hiding this comment

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

Code looks good, please fix tests though

Comment on lines 54 to +56
user.update!(phone_number_verified: true)
user.update!(use_sms_auth: true)
user.update!(use_two_factor_authentication: true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we pass these in create?

Comment on lines 94 to +96
user.update!(phone_number_verified: true)
user.update!(use_sms_auth: true)
user.update!(use_two_factor_authentication: true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we pass these in create?


it "can be enabled with SMS auth" do
user = create(:user, phone_number: "+18556254225", phone_number_verified: true)
user.update!(use_sms_auth: true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we pass this in create?

Copy link
Member Author

Choose a reason for hiding this comment

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

No because of callbacks in the User model, any time the phone number is changed, use_sms_auth becomes false.

@sampoder sampoder merged commit 78e3cd0 into main Dec 29, 2025
20 checks passed
@sampoder sampoder deleted the 2fa-require-a-second-factor branch December 29, 2025 20:20
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.

[User] Prevent use_two_factor_authentication when only 1 factor is available

4 participants