Class: RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Defined in:
lib/generators/happy_seed/omniauth/templates/app/controllers/registrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#update_resource(resource, params) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/happy_seed/omniauth/templates/app/controllers/registrations_controller.rb', line 2

def update_resource(resource, params)
  if resource.encrypted_password.blank? # || params[:password].blank?
    resource.email = params[:email] if params[:email]
    if !params[:password].blank? && params[:password] == params[:password_confirmation]
      logger.info "Updating password"
      resource.password = params[:password]
      resource.save
    end
    if resource.valid?
      resource.update_without_password(params)
    end
  else
    resource.update_with_password(params)
  end
end