Class: SessionsController
- Inherits:
-
Devise::RegistrationsController
- Object
- Devise::RegistrationsController
- SessionsController
show all
- Includes:
- ApplicationHelper
- Defined in:
- app/controllers/sessions_controller.rb
Instance Method Summary
collapse
#devise_mapping, #resource, #resource_name
Instance Method Details
#create ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/controllers/sessions_controller.rb', line 8
def create
params = sign_in_params
@user = User.find_by(email: params[:email])
if @user == nil || !@user.valid_password?(params[:password])
redirect_to "/signin"
return
end
sign_in(@user)
if !current_user.admin
Apartment::Tenant.switch!(Company.find(current_user.company_id).company_name.gsub(/'/,'').gsub(/\s/,''))
end
redirect_to "/pearlception"
end
|
#new ⇒ Object
4
5
6
|
# File 'app/controllers/sessions_controller.rb', line 4
def new
super
end
|