Sha256: b0d5c5a8c93cb3830d07b4a8a667c3f7496efdddb4fa62c1fb977a0b32ed83f2
Contents?: true
Size: 1.08 KB
Versions: 6
Compression:
Stored size: 1.08 KB
Contents
class Admin::UserSessionsController < Admin::ApplicationController skip_before_action :require_admin_user layout 'admin/login' def new if current_user redirect_to admin_root_path elsif SpudUser.all.count == 0 logger.debug "NO USERS!" redirect_to admin_setup_path and return end @user_session = SpudUserSession.new end def create @user_session = SpudUserSession.new(params[:spud_user_session]) if @user_session.save flash[:notice] = "Login successful!" redirect_to redirect_path_for_admin else render :action => :new end end def destroy current_user_session.destroy flash[:notice] = "Logout successful!" if !request.referer.blank? session[:return_to] = request.referer end redirect_to admin_login_path end def legacy_redirect redirect_to admin_login_path end private def redirect_path_for_admin back_or_default = back_or_default(admin_root_path) if /\/admin\//.match(back_or_default) return back_or_default else return admin_root_path end end end
Version data entries
6 entries across 6 versions & 1 rubygems