Переглянути джерело

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 роки тому
джерело
коміт
5ccbe10d10
1 змінених файлів з 5 додано та 3 видалено
  1. 5
    3
      app/models/user.rb

+ 5
- 3
app/models/user.rb Переглянути файл

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

Завантаження…
Відмінити
Зберегти