mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
a455567f9e
* add data migration to keep only unexpired or most recently expired user password * refactor to 1:1 relationship between User and UserPassword * add migration to remove redundant indexes on user passwords
16 lines
367 B
Ruby
16 lines
367 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UserPasswordExpirer
|
|
def self.expire_user_password(user)
|
|
UserPassword
|
|
.where(user:)
|
|
.first_or_initialize
|
|
.update!(
|
|
password_hash: user.password_hash,
|
|
password_salt: user.salt,
|
|
password_algorithm: user.password_algorithm,
|
|
password_expired_at: Time.zone.now,
|
|
)
|
|
end
|
|
end
|