forked from External/greenlight
		
	Fixed small issue with sign in to prevent error pages from appearing (#868)
This commit is contained in:
		
				
					committed by
					
						
						Richard Alam
					
				
			
			
				
	
			
			
			
						parent
						
							c92c8ad1ca
						
					
				
				
					commit
					d35a554199
				
			@@ -65,13 +65,13 @@ class SessionsController < ApplicationController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    user = User.include_deleted.find_by(email: session_params[:email])
 | 
					    user = User.include_deleted.find_by(email: session_params[:email])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Check user with that email exists
 | 
					    is_super_admin = user&.has_role? :super_admin
 | 
				
			||||||
    return redirect_to(signin_path, alert: I18n.t("invalid_credentials")) unless user
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    is_super_admin = user.has_role? :super_admin
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Scope user to domain if the user is not a super admin
 | 
					    # Scope user to domain if the user is not a super admin
 | 
				
			||||||
    user = User.include_deleted.find_by(email: session_params[:email], provider: @user_domain) unless is_super_admin
 | 
					    user = User.include_deleted.find_by(email: session_params[:email], provider: @user_domain) unless is_super_admin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Check user with that email exists
 | 
				
			||||||
 | 
					    return redirect_to(signin_path, alert: I18n.t("invalid_credentials")) unless user
 | 
				
			||||||
    # Check correct password was entered
 | 
					    # Check correct password was entered
 | 
				
			||||||
    return redirect_to(signin_path, alert: I18n.t("invalid_credentials")) unless user.try(:authenticate,
 | 
					    return redirect_to(signin_path, alert: I18n.t("invalid_credentials")) unless user.try(:authenticate,
 | 
				
			||||||
      session_params[:password])
 | 
					      session_params[:password])
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user