Sha256: 518608d230012afae58c5661f6668c42eaf2fb6ad46cbb87e7caed09991abe4d
Contents?: true
Size: 483 Bytes
Versions: 11
Compression:
Stored size: 483 Bytes
Contents
class SessionsController < ApplicationController def new end def create @user = User.find_by(email: params[:email]) if @user && @user.authenticate(params[:password]) session[:user_id] = @user.id redirect_to params[:return_to] || root_url, notice: "Logged in!" else flash[:warning] = "You have entered incorrect email and/or password." render :new end end def destroy session.delete(:user_id) redirect_to root_path end end
Version data entries
11 entries across 11 versions & 1 rubygems