Sha256: 40983b57da20c4db6bc73bf0e781f0697ad25321a38c41fa3803bd0d45c6eb01

Contents?: true

Size: 1.23 KB

Versions: 13

Compression:

Stored size: 1.23 KB

Contents

class DeviseExtensions::RegistrationsController < Devise::RegistrationsController
  # GET /resource/sign_up
  def new
    resource = build_resource({})
    
    @presenter = Resources::User::FormPresenter.new(self.view_context, resource: resource)  
    
    respond_with resource
  end
  
  # POST /resource
  def create
    build_resource(params[:user])

    captcha_verified = if Rails.env == 'production'
      verify_recaptcha(model: resource, message: I18n.t('general.exceptions.wrong_recaptcha'))
    else
      true
    end
     
    if captcha_verified && resource.save
      if resource.active_for_authentication?
        set_flash_message :notice, :signed_up if is_navigational_format?
        sign_in(resource_name, resource)
        respond_with resource, :location => after_sign_up_path_for(resource)
      else
        set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
        expire_session_data_after_sign_in!
        respond_with resource, :location => after_inactive_sign_up_path_for(resource)
      end
    else
      @presenter = Resources::User::FormPresenter.new(self.view_context, resource: resource)  
      clean_up_passwords resource
      respond_with resource
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
voluntary-0.7.1 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.7.0 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.6.0 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.5.2 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.5.1 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.5.0 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.4.0 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.3.0 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.2.4 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.2.3 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.2.2 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.2.1 app/controllers/devise_extensions/registrations_controller.rb
voluntary-0.2.0 app/controllers/devise_extensions/registrations_controller.rb