iachat/app/controllers/devise_overrides
Shivam Mishra 211fb1102d
chore: rotate oauth password if unconfirmed (#13878)
When a user signs up with an email they don't own and sets a password,
that password remains valid even after the real owner later signs in via
OAuth. This means the original registrant — who never proved ownership
of the email — retains working credentials on the account. This change
closes that gap by rotating the password to a random value whenever an
unconfirmed user completes an OAuth sign-in.

The check (`oauth_user_needs_password_reset?`) is evaluated before
`skip_confirmation!` runs, since confirmation would flip `confirmed_at`
and mask the condition. If the user was unconfirmed, the stored password
is replaced with a secure random string that satisfies the password
policy. This applies to both the web and mobile OAuth callback paths, as
well as the sign-up path where the password is rotated before the reset
token is generated.

Users who lose access to password-based login as a side effect can
recover through the standard "Forgot password" flow at any time. Since
they've already proven email ownership via OAuth, this is a low-friction
recovery path
2026-04-02 11:26:29 +05:30
..
confirmations_controller.rb fix: DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated (#5560) 2022-10-05 17:24:34 -07:00
omniauth_callbacks_controller.rb chore: rotate oauth password if unconfirmed (#13878) 2026-04-02 11:26:29 +05:30
passwords_controller.rb fix: Prevent user enumeration on password reset endpoint (#13528) 2026-02-13 13:45:40 +05:30
sessions_controller.rb fix: Session controller to not generate auth tokens before mfa verification (#12487) 2025-09-23 19:13:47 +05:30
token_validations_controller.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30