Sha256: 9466bf07d3a54f8d54e63ecb929add3a1403f1934a3c2e56cde3fc16c369d488
Contents?: true
Size: 747 Bytes
Versions: 13
Compression:
Stored size: 747 Bytes
Contents
module Concen class SessionsController < ApplicationController layout "concen/application" def new if User.all.any? render else redirect_to new_concen_user_path end end def create user = User.where(:username => /#{params[:username]}/i).first if user && user.authenticate(params[:password]) cookies.permanent[:auth_token] = user.auth_token redirect_to concen_root_path, :notice => "You have successfully signed in!" else flash.now.alert = "Invalid email or password" render "new" end end def destroy cookies.delete(:auth_token) redirect_to root_path, :notice => "You have successfully signed out!" end end end
Version data entries
13 entries across 13 versions & 1 rubygems