Class: Maquina::SessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Maquina::SessionsController
- Defined in:
- app/controllers/maquina/sessions_controller.rb
Instance Method Summary collapse
Methods included from Authenticate
#after_authentication_url, #authenticated?, #current_user, #require_authentication
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/maquina/sessions_controller.rb', line 15 def create reset_session @user = Maquina::User.authenticate_by(email: params.dig(:email), password: params.dig(:password)) if @user.present? active_session = start_new_session_for(@user) if active_session.present? return redirect_to(calculate_redirect_path(active_session), notice: t("flash.sessions.create.notice"), status: :see_other) end end @user = Maquina::User.new(email: params.dig(:email)) flash.now.alert = t("flash.sessions.create.alert") render :new, status: :unprocessable_entity end |