diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 9a6af3e66b1b1328b71e5be77cb8cf1806c96337..eeaee0485719c9027f93d0de9021dc1e1521b2df 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -21,20 +21,23 @@ class SessionsController < Devise::SessionsController # yield resource if block_given? # respond_with resource, location: after_sign_in_path_for(resource) - # Get status of current city - current_city = CityHall.find_by(city_id: current_citizen.city_id) # Get resource self.resource = warden.authenticate!(auth_options) # Check if resource is not null and if a citizen has been signed_in if !resource.nil? && citizen_signed_in? + + # Get status of current city + current_city = CityHall.find_by(city_id: current_citizen.city_id) + + # if !resource.active # sign_out(resource) # flash[:alert] = "Sua conta está inativa, por favor contate o administrador!" # return redirect_to root_path # end - + # Set expiretion time to send message when expiring session session[:expires_at] = Time.current + 24.hours # Set variable to show loading bar @@ -81,7 +84,7 @@ class SessionsController < Devise::SessionsController # set_flash_message(:notice, :signed_in) if is_navigational_format? # sign_in(resource_name, resource) # respond_with resource, :location => root_path - + end end