mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-23 07:20:33 +00:00
Merge commit '6dee9a12d2c2c3671ad9f4bc035f050a7c9549c5' into glitch-soc/merge-4.3
This commit is contained in:
@@ -183,6 +183,10 @@ class User < ApplicationRecord
|
||||
|
||||
def disable!
|
||||
update!(disabled: true)
|
||||
|
||||
# This terminates all connections for the given account with the streaming
|
||||
# server:
|
||||
redis.publish("timeline:system:#{account.id}", Oj.dump(event: :kill))
|
||||
end
|
||||
|
||||
def enable!
|
||||
@@ -360,17 +364,22 @@ class User < ApplicationRecord
|
||||
end
|
||||
|
||||
def reset_password!
|
||||
# First, change password to something random, this revokes sessions and on-going access:
|
||||
change_password!(SecureRandom.hex)
|
||||
|
||||
# Finally, send a reset password prompt to the user
|
||||
send_reset_password_instructions
|
||||
end
|
||||
|
||||
def change_password!(new_password)
|
||||
# First, change password to something random and deactivate all sessions
|
||||
transaction do
|
||||
update(password: SecureRandom.hex)
|
||||
update(password: new_password)
|
||||
session_activations.destroy_all
|
||||
end
|
||||
|
||||
# Then, remove all authorized applications and connected push subscriptions
|
||||
revoke_access!
|
||||
|
||||
# Finally, send a reset password prompt to the user
|
||||
send_reset_password_instructions
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
Reference in New Issue
Block a user