Class: Aikotoba::SessionsController
Instance Method Summary
collapse
#aikotoba_authenticate_by_session, #aikotoba_current_account, #aikotoba_sign_in, #aikotoba_sign_out
#aikotoba_controller?
#confirmable?, #lockable?, #recoverable?, #registerable?
Instance Method Details
#create ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/aikotoba/sessions_controller.rb', line 12
def create
@account = authenticate_account(session_params.to_h.symbolize_keys)
if @account
before_sign_in_process
aikotoba_sign_in(@account)
after_sign_in_process
redirect_to after_sign_in_path, notice: successed_message
else
failed_sign_in_process
@account = build_account({email: "", password: ""})
flash[:alert] = failed_message
render :new, status: :unprocessable_entity
end
end
|
#destroy ⇒ Object
27
28
29
30
|
# File 'app/controllers/aikotoba/sessions_controller.rb', line 27
def destroy
aikotoba_sign_out if aikotoba_current_account
redirect_to after_sign_out_path, notice: signed_out_message
end
|
#new ⇒ Object
7
8
9
10
|
# File 'app/controllers/aikotoba/sessions_controller.rb', line 7
def new
return redirect_to after_sign_in_path if aikotoba_current_account
@account = build_account({email: "", password: ""})
end
|