Skip to content

Fix, Use devise_will_save_change_to_email? method for email change detection #1654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module DeviseTokenAuth::Concerns::ConfirmableSupport

included do
# Override standard devise `postpone_email_change?` method
# for not to use `will_save_change_to_email?` & `email_changed?` methods.
# for not to use `devise_will_save_change_to_email?` methods.
def postpone_email_change?
postpone = self.class.reconfirmable &&
email_value_in_database != email &&
Expand Down
3 changes: 1 addition & 2 deletions app/models/devise_token_auth/concerns/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ def self.tokens_match?(token_hash, token)

# don't use default devise email validation
def email_required?; false; end
def email_changed?; false; end
def will_save_change_to_email?; false; end
def devise_will_save_change_to_email?; false; end

if DeviseTokenAuth.send_confirmation_email && devise_modules.include?(:confirmable)
include DeviseTokenAuth::Concerns::ConfirmableSupport
Expand Down