Sha256: b7e4cf3811ee050825cf0a6bbc59aac79fc2f4d03a239b23a86a3d574a9b6569
Contents?: true
Size: 656 Bytes
Versions: 2
Compression:
Stored size: 656 Bytes
Contents
require_dependency "plotline/application_controller" module Plotline class SessionsController < ApplicationController skip_before_action :authenticate_user layout 'plotline/plain' def new end def create user = User.find_by_email(params[:email]) if user && user.authenticate(params[:password]) cookies.permanent[:auth_token] = user.auth_token flash[:notice] = "Hello!" redirect_to root_url else flash.now.alert = "Invalid email and/or password" render "new" end end def destroy cookies.delete(:auth_token) redirect_to root_url end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
plotline-0.1.1 | app/controllers/plotline/sessions_controller.rb |
plotline-0.1.0 | app/controllers/plotline/sessions_controller.rb |