mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 21:29:38 +02:00
23 lines
491 B
Ruby
23 lines
491 B
Ruby
class SessionsController < ApplicationController
|
|
skip_authentication only: %i[new create]
|
|
|
|
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
|