mirror of
https://github.com/meineerde/redmine.git
synced 2025-10-17 17:01:01 +00:00
Code cleanup (#17717).
git-svn-id: http://svn.redmine.org/redmine/trunk@13403 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d444dc61af
commit
5ccbe10d10
@ -687,10 +687,12 @@ class User < Principal
|
||||
# was compromised.
|
||||
def destroy_tokens
|
||||
tokens = []
|
||||
tokens |= ['recovery', 'autologin'] if changes.has_key?('hashed_password')
|
||||
tokens |= ['recovery'] if changes.has_key?('mail')
|
||||
tokens |= ['recovery', 'autologin'] if hashed_password_changed?
|
||||
tokens |= ['recovery'] if mail_changed?
|
||||
|
||||
Token.delete_all(['user_id = ? AND action IN (?)', self.id, tokens]) if tokens.any?
|
||||
if tokens.any?
|
||||
Token.where(:user_id => id, :action => tokens).delete_all
|
||||
end
|
||||
end
|
||||
|
||||
# Removes references that are not handled by associations
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user