diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-08-20 02:33:46 +0300 |
---|---|---|
committer | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-11-07 18:55:42 +0300 |
commit | 9d51421346178c9189ffb47189f51d573ab42822 (patch) | |
tree | 4990e9766af58e9dfc687f5451c6efe36fdbebcd /app/models/concerns/token_authenticatable.rb | |
parent | 09f4af04c6672f7e2d1584f9940a3d9ff53a4a4f (diff) |
Use separate email-friendly token for incoming email and let incoming
email token be reset
Diffstat (limited to 'app/models/concerns/token_authenticatable.rb')
-rw-r--r-- | app/models/concerns/token_authenticatable.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/models/concerns/token_authenticatable.rb b/app/models/concerns/token_authenticatable.rb index 24c7b26d223..04d30f46210 100644 --- a/app/models/concerns/token_authenticatable.rb +++ b/app/models/concerns/token_authenticatable.rb @@ -4,17 +4,21 @@ module TokenAuthenticatable private def write_new_token(token_field) - new_token = generate_token(token_field) + new_token = generate_available_token(token_field) write_attribute(token_field, new_token) end - def generate_token(token_field) + def generate_available_token(token_field) loop do - token = Devise.friendly_token + token = generate_token(token_field) break token unless self.class.unscoped.find_by(token_field => token) end end + def generate_token(token_field) + Devise.friendly_token + end + class_methods do def authentication_token_fields @token_fields || [] |