Class: DeviseTokenAuth::RegistrationsController
Instance Method Summary
collapse
#resource_data, #resource_errors
Instance Method Details
#account_update_params ⇒ Object
102
103
104
|
# File 'app/controllers/devise_token_auth/registrations_controller.rb', line 102
def account_update_params
params.permit(*params_for_resource(:account_update))
end
|
#create ⇒ Object
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
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
67
68
69
70
71
72
|
# File 'app/controllers/devise_token_auth/registrations_controller.rb', line 8
def create
@resource = resource_class.new(sign_up_params.except(:confirm_success_url))
@resource.provider = provider
if resource_class.case_insensitive_keys.include?(:email)
@resource.email = sign_up_params[:email].try :downcase
else
@resource.email = sign_up_params[:email]
end
@redirect_url = sign_up_params[:confirm_success_url]
@redirect_url ||= DeviseTokenAuth.default_confirm_success_url
if confirmable_enabled? && !@redirect_url
return render_create_error_missing_confirm_success_url
end
if DeviseTokenAuth.redirect_whitelist
unless DeviseTokenAuth::Url.whitelisted?(@redirect_url)
return render_create_error_redirect_url_not_allowed
end
end
begin
resource_class.set_callback("create", :after, :send_on_create_confirmation_instructions)
resource_class.skip_callback("create", :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
})
else
@client_id, @token = @resource.create_token
@resource.save!
end
render_create_success
else
clean_up_passwords @resource
render_create_error
end
rescue ActiveRecord::RecordNotUnique
clean_up_passwords @resource
render_create_error_email_already_exists
end
end
|
#destroy ⇒ Object
87
88
89
90
91
92
93
94
95
96
|
# File 'app/controllers/devise_token_auth/registrations_controller.rb', line 87
def destroy
if @resource
@resource.destroy
yield @resource if block_given?
render_destroy_success
else
render_destroy_error
end
end
|
#sign_up_params ⇒ Object
98
99
100
|
# File 'app/controllers/devise_token_auth/registrations_controller.rb', line 98
def sign_up_params
params.permit([*params_for_resource(:sign_up), :confirm_success_url])
end
|
#update ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'app/controllers/devise_token_auth/registrations_controller.rb', line 74
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
|