Commit f5d2f13e authored by Cynthia Oliveira's avatar Cynthia Oliveira

Merge branch 'Issue#142' into 'master'

fix error when user puts wrong password
Signed-off-by: Matheus Horstmann's avatarMatheus Horstmann <mch15@inf.ufpr.br>

See merge request !249
parents 6ce89852 28f05b2c
...@@ -21,20 +21,23 @@ class SessionsController < Devise::SessionsController ...@@ -21,20 +21,23 @@ class SessionsController < Devise::SessionsController
# yield resource if block_given? # yield resource if block_given?
# respond_with resource, location: after_sign_in_path_for(resource) # 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 # Get resource
self.resource = warden.authenticate!(auth_options) self.resource = warden.authenticate!(auth_options)
# Check if resource is not null and if a citizen has been signed_in # Check if resource is not null and if a citizen has been signed_in
if !resource.nil? && citizen_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 # if !resource.active
# sign_out(resource) # sign_out(resource)
# flash[:alert] = "Sua conta está inativa, por favor contate o administrador!" # flash[:alert] = "Sua conta está inativa, por favor contate o administrador!"
# return redirect_to root_path # return redirect_to root_path
# end # end
# Set expiretion time to send message when expiring session # Set expiretion time to send message when expiring session
session[:expires_at] = Time.current + 24.hours session[:expires_at] = Time.current + 24.hours
# Set variable to show loading bar # Set variable to show loading bar
...@@ -81,7 +84,7 @@ class SessionsController < Devise::SessionsController ...@@ -81,7 +84,7 @@ class SessionsController < Devise::SessionsController
# set_flash_message(:notice, :signed_in) if is_navigational_format? # set_flash_message(:notice, :signed_in) if is_navigational_format?
# sign_in(resource_name, resource) # sign_in(resource_name, resource)
# respond_with resource, :location => root_path # respond_with resource, :location => root_path
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment