Files
sure/app/controllers/sessions_controller.rb
Jose Farias c5192ee424 Centralize auth messages (#269)
* Add i18n-tasks

* Add auth-related i18n

* Centralize auth messages

* Remove safe navigation

* Revert "Remove safe navigation"

This reverts commit 56b5e01e5e0ab9f54a9a5d9f5559e29897d239a4.

* Remove newline in Gemfile
2024-02-03 14:17:49 -06:00

22 lines
447 B
Ruby

class SessionsController < ApplicationController
layout "auth"
def new
end
def create
if user = User.authenticate_by(email: params[:email], password: params[:password])
login user
redirect_to root_path
else
flash.now[:alert] = t(".invalid_credentials")
render :new, status: :unprocessable_entity
end
end
def destroy
logout
redirect_to root_path, notice: t(".logout_successful")
end
end