Class: Auth::CustomerRegistrationsController
- Inherits:
-
Devise::RegistrationsController
- Object
- Devise::RegistrationsController
- Auth::CustomerRegistrationsController
show all
- Includes:
- Controllers::MasqueradeGuarded
- Defined in:
- app/controllers/auth/customer_registrations_controller.rb
Overview
Constant Summary
Controllers::MasqueradeGuarded::DEFAULT_BLOCK_MESSAGE
Instance Method Summary
collapse
block_while_masquerading, #masquerade_blocks?
Instance Method Details
#edit ⇒ Object
40
41
42
|
# File 'app/controllers/auth/customer_registrations_controller.rb', line 40
def edit
@account = Account.find(current_account.id)
end
|
#edit_email ⇒ Object
16
17
18
19
|
# File 'app/controllers/auth/customer_registrations_controller.rb', line 16
def edit_email
@account = Account.find(current_account.id)
render :edit_email
end
|
#set_report_errors_for ⇒ Object
This controller instance set the model to use for detecting errors in the application_controller#write_flash_to_cookie method.
73
74
75
|
# File 'app/controllers/auth/customer_registrations_controller.rb', line 73
def set_report_errors_for
@report_errors_for = [resource]
end
|
#update ⇒ Object
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
|
# File 'app/controllers/auth/customer_registrations_controller.rb', line 44
def update
@account = Account.find(current_account.id)
pass = params[:account].delete(:current_password)
if @account.encrypted_password.blank? or @account.valid_password?(pass)
if params[:account][:password] and params[:account][:password] == params[:account][:password_confirmation]
if @account.update(params[:account])
@account.notify({ activity: 'update_password' })
bypass_sign_in @account
@account.restore_authentication_token! set_flash_message :notice, :updated
redirect_to my_account_path
else
render :edit, status: :unprocessable_entity
end
else
flash.now[:error] = 'Uh oh! Password does not match confirmation.'
render :edit, status: :unprocessable_entity
end
else
flash.now[:error] = 'Uh oh! Incorrect password. Please enter your current password to change your password.'
render :edit, status: :unprocessable_entity
end
end
|
#update_email ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/auth/customer_registrations_controller.rb', line 21
def update_email
@account = Account.find(current_account.id)
pass = params[:account].delete(:password)
if (@account.encrypted_password.blank? && @account.authentications.present?) || @account.valid_password?(pass)
old_email = @account.email
old_login = @account.login
if @account.update_without_password(params[:account])
@account.notify({ activity: 'update_email', old_email: old_email, old_login: old_login })
set_flash_message :notice, :updated
redirect_to my_account_path
else
render :edit_email, status: :unprocessable_entity
end
else
flash.now[:error] = 'Uh oh! Incorrect password. Please enter your current password to change your e-mail/login.'
render :edit_email, status: :unprocessable_entity
end
end
|