Sha256: f2b0234b347e5205681bf7590a07ed07693e676ad975158ead75aa056c64d564
Contents?: true
Size: 1.54 KB
Versions: 9
Compression:
Stored size: 1.54 KB
Contents
module Alchemy class UserSessionsController < Devise::SessionsController # Necessary because this controller is also used for general login. include Ferret::Search helper 'Alchemy::Admin::Base', 'Alchemy::Pages' before_filter(except: 'destroy') { enforce_ssl if ssl_required? && !request.ssl? } before_filter :set_translation before_filter :check_user_count, :only => :new layout 'alchemy/login' def new super end def create authenticate_user! if user_signed_in? store_screen_size if session[:redirect_path].blank? redirect_path = admin_dashboard_path else # We have to strip double slashes from beginning of path, because of strange rails/rack bug. redirect_path = session[:redirect_path].gsub(/^\/{2,}/, '/') end redirect_to redirect_path, :notice => t(:signed_in, :scope => 'devise.sessions') else super end end def leave render layout: !request.xhr? end def destroy cookies.clear session.clear super end private def check_user_count if User.count == 0 redirect_to signup_path else return true end end def store_screen_size session[:screen_size] = params[:user_screensize] end # Ovewriting the default of Devise def after_sign_out_path_for(resource_or_scope) if request.referer.blank? || request.referer.to_s =~ /admin/ root_path else request.referer end end end end
Version data entries
9 entries across 9 versions & 1 rubygems