Class: DeviseTokenAuth::RegistrationsController
Instance Method Summary
collapse
#resource_data, #resource_errors
Instance Method Details
#account_update_params ⇒ Object
95
96
97
|
# File 'app/controllers/devise_token_auth/registrations_controller.rb', line 95
def account_update_params
params.permit(*params_for_resource(:account_update))
end
|
#create ⇒ Object
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'app/controllers/devise_token_auth/registrations_controller.rb', line 10
def create
build_resource
unless @resource.present?
raise DeviseTokenAuth::Errors::NoResourceDefinedError,
"#{self.class.name} #build_resource does not define @resource,"\
' execution stopped.'
end
@redirect_url = params.fetch(
:confirm_success_url,
DeviseTokenAuth.default_confirm_success_url
)
if confirmable_enabled? && !@redirect_url
return render_create_error_missing_confirm_success_url
end
return render_create_error_redirect_url_not_allowed if blacklisted_redirect_url?(@redirect_url)
callback_name = defined?(ActiveRecord) && resource_class < ActiveRecord::Base ? :commit : :create
resource_class.set_callback(callback_name, :after, :send_on_create_confirmation_instructions)
resource_class.skip_callback(callback_name, :after, :send_on_create_confirmation_instructions)
if @resource.respond_to? :skip_confirmation_notification!
@resource.skip_confirmation_notification!
end
if @resource.save
yield @resource if block_given?
unless @resource.confirmed?
@resource.send_confirmation_instructions({
client_config: params[:config_name],
redirect_url: @redirect_url
})
end
if active_for_authentication?
@token = @resource.create_token
@resource.save!
end
render_create_success
else
clean_up_passwords @resource
render_create_error
end
end
|
#destroy ⇒ Object
81
82
83
84
85
86
87
88
89
|
# File 'app/controllers/devise_token_auth/registrations_controller.rb', line 81
def destroy
if @resource
@resource.destroy
yield @resource if block_given?
render_destroy_success
else
render_destroy_error
end
end
|
#sign_up_params ⇒ Object
91
92
93
|
# File 'app/controllers/devise_token_auth/registrations_controller.rb', line 91
def sign_up_params
params.permit(*params_for_resource(:sign_up))
end
|
#update ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'app/controllers/devise_token_auth/registrations_controller.rb', line 68
def update
if @resource
if @resource.send(resource_update_method, account_update_params)
yield @resource if block_given?
render_update_success
else
render_update_error
end
else
render_update_error_user_not_found
end
end
|