mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Rename reset_confirmation! to resend_confirmation!
This commit is contained in:
parent
4f4ac1653f
commit
358a2389ce
2 changed files with 5 additions and 5 deletions
|
@ -27,7 +27,7 @@ module Devise
|
|||
# User.find(1).confirm! # returns true unless it's already confirmed
|
||||
# User.find(1).confirmed? # true/false
|
||||
# User.find(1).send_confirmation_instructions # manually send instructions
|
||||
# User.find(1).reset_confirmation! # reset confirmation status and send instructions
|
||||
# User.find(1).resend_confirmation! # generates a new token and resent it
|
||||
module Confirmable
|
||||
|
||||
def self.included(base)
|
||||
|
@ -62,7 +62,7 @@ module Devise
|
|||
# Remove confirmation date and send confirmation instructions, to ensure
|
||||
# after sending these instructions the user won't be able to sign in without
|
||||
# confirming it's account
|
||||
def reset_confirmation!
|
||||
def resend_confirmation!
|
||||
unless_confirmed do
|
||||
generate_confirmation_token
|
||||
save(false)
|
||||
|
@ -129,7 +129,7 @@ module Devise
|
|||
# Options must contain the user email
|
||||
def send_confirmation_instructions(attributes={})
|
||||
confirmable = find_or_initialize_with_error_by(:email, attributes[:email], :not_found)
|
||||
confirmable.reset_confirmation! unless confirmable.new_record?
|
||||
confirmable.resend_confirmation! unless confirmable.new_record?
|
||||
confirmable
|
||||
end
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class ConfirmableTest < ActiveSupport::TestCase
|
|||
user = create_user
|
||||
3.times do
|
||||
token = user.confirmation_token
|
||||
user.reset_confirmation!
|
||||
user.resend_confirmation!
|
||||
assert_not_equal token, user.confirmation_token
|
||||
end
|
||||
end
|
||||
|
@ -168,7 +168,7 @@ class ConfirmableTest < ActiveSupport::TestCase
|
|||
test 'should not be able to send instructions if the user is already confirmed' do
|
||||
user = create_user
|
||||
user.confirm!
|
||||
assert_not user.reset_confirmation!
|
||||
assert_not user.resend_confirmation!
|
||||
assert user.confirmed?
|
||||
assert_equal 'already confirmed', user.errors[:email]
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue