mirror of
https://github.com/we-promise/sure.git
synced 2026-04-08 06:44:52 +00:00
root ➜ /workspace (fix-rubocop-issues) $ rubocop Inspecting 54 files ...................................................... 54 files inspected, no offenses detected
22 lines
462 B
Ruby
22 lines
462 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] = "Invalid email or password."
|
|
render :new, status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
logout
|
|
redirect_to root_path, notice: "You have signed out successfully."
|
|
end
|
|
end
|