X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/9c0582f88fd2ef4e20c6eb922bcd4cb1a04258d5..b31951000f028b9d79cad8ae9b0c985eb1c9f6c9:/app/models/user.rb diff --git a/app/models/user.rb b/app/models/user.rb index d7bfb2235..c809b6192 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -210,6 +210,7 @@ class User < ApplicationRecord # Mark the account as deleted and remove personal data event :soft_destroy do before do + revoke_authentication_tokens remove_personal_data end @@ -299,6 +300,13 @@ class User < ApplicationRecord blocks.active.detect(&:needs_view?) end + ## + # revoke any authentication tokens + def revoke_authentication_tokens + oauth_tokens.authorized.each(&:invalidate!) + access_tokens.not_expired.each(&:revoke) + end + ## # remove personal data - leave the account but purge most personal data def remove_personal_data