1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-20 05:39:39 +02:00
Maybe/app/controllers/sessions_controller.rb

24 lines
491 B
Ruby
Raw Normal View History

2024-02-02 09:05:04 -06:00
class SessionsController < ApplicationController
2024-04-03 10:35:55 -04:00
skip_authentication only: %i[new create]
2024-02-02 09:05:04 -06:00
layout "auth"
2024-02-02 09:05:04 -06:00
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")
2024-02-02 09:05:04 -06:00
render :new, status: :unprocessable_entity
end
end
2024-02-02 09:05:04 -06:00
def destroy
logout
redirect_to root_path, notice: t(".logout_successful")
2024-02-02 09:05:04 -06:00
end
end