Sha256: 41bee973d6006bb7a1be611d138e13df5c82b3556350ade4000acb2bf1a94683
Contents?: true
Size: 567 Bytes
Versions: 16
Compression:
Stored size: 567 Bytes
Contents
class SessionsController < ApplicationController def new end def create @user = User.authenticate(params[:email], params[:password]) if @user if params[:remember_me] cookies.permanent[:auth_token] = @user.auth_token else cookies[:auth_token] = @user.auth_token end redirect_to root_url, notice: "Logged in!" else flash.now.alert = "Invalid email or password" render "new" end end def destroy cookies.delete(:auth_token) redirect_to root_url, notice: "Logged out!" end end
Version data entries
16 entries across 8 versions & 1 rubygems