Browse Source

Code cleanup (#17717).

git-svn-id: http://svn.redmine.org/redmine/trunk@13403 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/2.6.0
Jean-Philippe Lang 9 years ago
parent
commit
5ccbe10d10
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      app/models/user.rb

+ 5
- 3
app/models/user.rb 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

Loading…
Cancel
Save