Added required_fields when reconfirmable
This commit is contained in:
parent
bc11e9f300
commit
a909bfaf85
|
@ -37,7 +37,12 @@ module Devise
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.required_fields(klass)
|
def self.required_fields(klass)
|
||||||
[:confirmation_token, :confirmed_at, :confirmation_sent_at]
|
required_methods = [:confirmation_token, :confirmed_at, :confirmation_sent_at]
|
||||||
|
if klass.reconfirmable
|
||||||
|
required_methods << :unconfirmed_email
|
||||||
|
end
|
||||||
|
|
||||||
|
required_methods
|
||||||
end
|
end
|
||||||
|
|
||||||
# Confirm a user by setting it's confirmed_at to actual time. If the user
|
# Confirm a user by setting it's confirmed_at to actual time. If the user
|
||||||
|
|
|
@ -336,4 +336,13 @@ class ReconfirmableTest < ActiveSupport::TestCase
|
||||||
:confirmed_at
|
:confirmed_at
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'required_fields should also contain unconfirmable when reconfirmable_email is true' do
|
||||||
|
assert_same_content Devise::Models::Confirmable.required_fields(Admin), [
|
||||||
|
:confirmation_sent_at,
|
||||||
|
:confirmation_token,
|
||||||
|
:confirmed_at,
|
||||||
|
:unconfirmable_email
|
||||||
|
]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue