Class: Aikotoba::SessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Aikotoba::SessionsController
- Includes:
- Authenticatable
- Defined in:
- app/controllers/aikotoba/sessions_controller.rb
Instance Method Summary collapse
Methods included from Authenticatable
#aikotoba_current_account, #aikotoba_sign_in, #aikotoba_sign_out
Methods included from Scopable
#aikotoba_scope, #aikotoba_scope_config, #aikotoba_scoped_path
Methods inherited from ApplicationController
Methods included from EnabledFeatureCheckable
#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: else failed_sign_in_process @account = build_account({email: "", password: ""}) flash[:alert] = 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: 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 |