1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Required fields on token_authenticatable

This commit is contained in:
Rodrigo Flores 2012-02-17 15:50:15 -02:00
parent 533511f8c3
commit f3bace570d
2 changed files with 14 additions and 0 deletions

View file

@ -27,6 +27,14 @@ module Devise
module TokenAuthenticatable
extend ActiveSupport::Concern
module ModuleMethods
extend self
def required_fields
[:authentication_token]
end
end
# Generate new authentication token (a.k.a. "single access token").
def reset_authentication_token
self.authentication_token = self.class.authentication_token

View file

@ -46,4 +46,10 @@ class TokenAuthenticatableTest < ActiveSupport::TestCase
user = User.find_for_token_authentication(:auth_token => {'$ne' => user1.authentication_token})
assert_nil user
end
test 'required_fields should contain the fields that Devise uses' do
assert_equal Devise::Models::TokenAuthenticatable::ModuleMethods.required_fields.sort, [
:authentication_token
]
end
end