500 internal server error (fixes #277) (#279)

* <Fixed bug>

* <Fixed some errors>

* <fixed rspec tests>

* <Made requested changes>

* Delete search.js
This commit is contained in:
John Ma
2018-10-02 17:48:01 -04:00
committed by Jesus Federico
parent dcd24d61be
commit f0f0638be3
3 changed files with 17 additions and 2 deletions

View File

@ -28,7 +28,9 @@ class SessionsController < ApplicationController
# POST /users/login
def create
user = User.find_by(email: session_params[:email])
if user.try(:authenticate, session_params[:password])
if user && !user.greenlight_account?
redirect_to root_path, notice: I18n.t("invalid_login_method")
elsif user.try(:authenticate, session_params[:password])
login(user)
else
redirect_to root_path, notice: I18n.t("invalid_credentials")