Class: Aikotoba::RecoveriesController
Instance Method Summary
collapse
#aikotoba_controller?
#confirmable?, #lockable?, #recoverable?, #registerable?
Instance Method Details
#create ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/aikotoba/recoveries_controller.rb', line 13
def create
account = find_by_send_token_account!(send_recovery_token_params)
before_send_recovery_token_process
send_recovery_token!(account)
after_send_recovery_token_process
redirect_to success_send_recovery_token_path, flash: {notice: success_send_recovery_token_message}
rescue ActiveRecord::RecordNotFound => e
failed_send_recovery_token_process(e)
@account = build_account({email: "", password: ""})
flash[:alert] = failed_send_recovery_token_message
render :new, status: :unprocessable_entity
end
|
#edit ⇒ Object
26
27
28
|
# File 'app/controllers/aikotoba/recoveries_controller.rb', line 26
def edit
@account = find_by_has_token_account!(params)
end
|
#new ⇒ Object
9
10
11
|
# File 'app/controllers/aikotoba/recoveries_controller.rb', line 9
def new
@account = build_account({email: "", password: ""})
end
|
#update ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/aikotoba/recoveries_controller.rb', line 30
def update
@account = find_by_has_token_account!(params)
before_recover_process
recover_account!(@account, recover_accounts_params[:password])
after_recover_process
redirect_to success_recovered_path, flash: {notice: success_recovered_message}
rescue ActiveRecord::RecordInvalid => e
failed_recover_process(e)
flash[:alert] = failed_message
render :edit, status: :unprocessable_entity
end
|