Class: DeviseExtensions::RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Defined in:
app/controllers/devise_extensions/registrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /resource



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/devise_extensions/registrations_controller.rb', line 12

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?
      (resource_name, resource)
      respond_with resource, :location => (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 => (resource)
    end
  else
    @presenter = Resources::User::FormPresenter.new(self.view_context, resource: resource)  
    clean_up_passwords resource
    respond_with resource
  end
end

#newObject

GET /resource/sign_up



3
4
5
6
7
8
9
# File 'app/controllers/devise_extensions/registrations_controller.rb', line 3

def new
  resource = build_resource({})
  
  @presenter = Resources::User::FormPresenter.new(self.view_context, resource: resource)  
  
  respond_with resource
end