Sha256: 6b3a9d340448bb8057db3c799563d36aacd5bfff528c4233b3134ce4a2ad97e7
Contents?: true
Size: 721 Bytes
Versions: 1
Compression:
Stored size: 721 Bytes
Contents
class SessionsController < ApplicationController def new end def create user = User.find_by_email(params[:email]) if user && user.authenticate(params[:password]) if params[:remember_me] cookies.permanent[:auth_token] = user.auth_token else cookies[:auth_token] = user.auth_token end redirect_to (session[:target_page] || root_url), notice: t('authentication.login_confirmation') session[:target_page] = nil else flash.now.alert = t('authentication.warning.email_or_password_invalid') render "new" end end def destroy cookies.delete(:auth_token) redirect_to root_url, notice: t('authentication.logout_confirmation') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tkh_authentication-0.0.6 | app/controllers/sessions_controller.rb |