Sha256: eb366154335223d86304c7677c59df32cdfd77572a29bfeea0ab5239d15b0f89
Contents?: true
Size: 653 Bytes
Versions: 1
Compression:
Stored size: 653 Bytes
Contents
require_dependency "bagboy/application_controller" module Bagboy class SessionsController < ApplicationController def new render 'new' end def create user = Bagboy::User.find_by_email(params[:email]) if user && user.authenticate(params[:password]) session[:user_id] = user.id redirect_to root_url, flash: {success: 'You have successfuly logged in!'} else flash.now.alert = 'Invalid email or password' render "new" end end def destroy session[:user_id] = nil redirect_to root_url, flash: { success: 'You have successfuly logged out!'} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bagboy-0.0.1 | app/controllers/bagboy/sessions_controller.rb |