Class: SessionsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Includes:
ApplicationHelper
Defined in:
app/controllers/sessions_controller.rb

Overview

@FIXME: When logging out users are prompted that there accounts have been cancelled when really they just logged out.

Instance Method Summary collapse

Methods included from ApplicationHelper

#devise_mapping, #resource, #resource_name

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/sessions_controller.rb', line 10

def create
  params = 
  @user = User.find_by(email: params[:email])
  if @user == nil || !@user.valid_password?(params[:password])
    redirect_to "/signin"
    return
  end
  #Do we need this code below? It was never running before
  #resource = warden.authenticate!(:scope => :user)
  (@user)
  if !current_user.admin
    Apartment::Tenant.switch!(Company.find(current_user.company_id).company_name.gsub(/'/,'').gsub(/\s/,''))
  end
  redirect_to "/pearlception"
end

#newObject



6
7
8
# File 'app/controllers/sessions_controller.rb', line 6

def new
  super
end