module Devise::Models::RemoteAuthenticatable

Public Instance Methods

remote_authentication(authentication_hash) click to toggle source

Here you do the request to the external webservice

If the authentication is successful you should return a resource instance

If the authentication fails you should return false

# File lib/devise/models/remote_authenticatable.rb, line 14
def remote_authentication(authentication_hash)
  self.class.authenticate(authentication_hash) # call MnoEnterprise::User.authenticate
end
send_password_change_notification() click to toggle source
# File lib/devise/models/remote_authenticatable.rb, line 23
def send_password_change_notification
  send_devise_notification(:password_change)
end

Protected Instance Methods

send_password_change_notification?() click to toggle source
# File lib/devise/models/remote_authenticatable.rb, line 69
def send_password_change_notification?
  self.class.send_password_change_notification && @password_changed
end
track_password_changed() click to toggle source

We want to send the notification once the password has changed but we won't have access to dirty attributes. Flag change before the model is saved. Do not send a notification at confirmation

# File lib/devise/models/remote_authenticatable.rb, line 64
def track_password_changed
  @password_changed = password_changed? && confirmed_at_was.present?
  true # before callback needs to return true to continue
end