Class: Users::RegistrationsController

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

Instance Method Summary collapse

Instance Method Details

#createObject


6
7
8
9
10
11
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
37
38
39
# File 'app/controllers/users/registrations_controller.rb', line 6

def create
  build_resource()

  ActiveRecord::Base.transaction do
    resource_saved = resource.save
    yield resource if block_given?
    if resource_saved
      if session[:invitation_code].present?
        InvitationCodeService.invite(resource, session[:invitation_code])
        @redirect_url = session[:invitation_redirect_url] || root_path
        session[:invitation_code] = nil
        session[:invitation_redirect_url] = nil
      end
      if resource.confirmed?
         resource
        SignonStatusTokenService.update_cookie(cookies, current_user)
        SiteIdentityTokenService.update(cookies, current_user)
        redirect_to @redirect_url and return if @redirect_url
      else
        set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_flashing_format?
        expire_data_after_sign_in!
        resource.send_confirmation_instructions
        respond_with resource, location: (resource)
      end
    else
      clean_up_passwords resource
      @validatable = devise_mapping.validatable?
      if @validatable
        @minimum_password_length = resource_class.password_length.min
      end
      respond_with resource
    end
  end
end

#destroyObject


45
46
47
# File 'app/controllers/users/registrations_controller.rb', line 45

def destroy
  redirect_to root_path
end

#newObject


2
3
4
# File 'app/controllers/users/registrations_controller.rb', line 2

def new
  super
end

#updateObject


41
42
43
# File 'app/controllers/users/registrations_controller.rb', line 41

def update
  super
end