Merge commit '6dee9a12d2c2c3671ad9f4bc035f050a7c9549c5' into glitch-soc/merge-4.3

This commit is contained in:
Claire
2025-10-13 15:58:48 +02:00
11 changed files with 116 additions and 36 deletions

View File

@@ -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