Sha256: e6232e9f96324be68604719b53f147b5e88f1b3ebb13319da0f09fc5953efe47
Contents?: true
Size: 443 Bytes
Versions: 10
Compression:
Stored size: 443 Bytes
Contents
class SessionsController < ApplicationController def new end def create user = User.authenticate(params[:username], params[:password]) if user session[:user_id] = user.id redirect_to root_url, notice: "Logged in!" else flash.now[:error] = "Invalid username or password." render "new" end end def destroy session[:user_id] = nil redirect_to root_url, notice: "Logged out!" end end
Version data entries
10 entries across 10 versions & 1 rubygems