Class: Ishapi::Users::RegistrationsController

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

Instance Method Summary collapse

Instance Method Details

#create {|resource| ... } ⇒ Object

Yields:

  • (resource)


5
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
# File 'app/controllers/ishapi/users/registrations_controller.rb', line 5

def create
  build_resource()
  resource.save
   = Ish::UserProfile.create({ email: resource.email })
  yield resource if block_given?
  if resource.persisted?
    render json: {
      status: :ok,
      message: "You have successfully registered! Please verify your email by clicking on a link we just sent you, before logging in.",
    }, status: 200

    # if resource.active_for_authentication?
    #   set_flash_message! :notice, :signed_up
    #   sign_up(resource_name, resource)
    #   respond_with resource, location: after_sign_up_path_for(resource)
    # else
    #   set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
    #   expire_data_after_sign_in!
    #   respond_with resource, location: after_inactive_sign_up_path_for(resource)
    # end
  else
    render json: {
      status: :not_ok,
      message: "Cannot register: #{resource.errors.full_messages.join(', ')}",
    }, status: 400

    # clean_up_passwords resource
    # set_minimum_password_length
    # respond_with resource
  end
end