1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +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:
Jean-Philippe Lang 2014-09-14 11:38:52 +00:00
parent d444dc61af
commit 5ccbe10d10

View File

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