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:
parent
533511f8c3
commit
f3bace570d
2 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue