forked from External/greenlight
* <Fixed bug> * <Fixed some errors> * <fixed rspec tests> * <Made requested changes> * Delete search.js
This commit is contained in:
parent
dcd24d61be
commit
f0f0638be3
|
@ -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")
|
||||
|
|
|
@ -67,6 +67,7 @@ en:
|
|||
home_room: Home Room
|
||||
info_update_success: Information successfully updated.
|
||||
invalid_credentials: Login failed due to invalid credentials. Are you sure you entered them correctly?
|
||||
invalid_login_method: Login failed due to account mismatch. You need to log in with omniauth.
|
||||
invite_message: "To invite someone to the meeting, send them this link:"
|
||||
landing:
|
||||
about: "%{href} is a simple front-end for your BigBlueButton open-source web conferencing server. You can create your own rooms to host sessions, or join others using a short and convenient link."
|
||||
|
|
|
@ -20,7 +20,8 @@ require "rails_helper"
|
|||
|
||||
describe SessionsController, type: :controller do
|
||||
before(:all) do
|
||||
@user = create(:user, password: "example", password_confirmation: "example")
|
||||
@user = create(:user, provider: "greenlight", password: "example", password_confirmation: "example")
|
||||
@omni_user = create(:user, password: "example", password_confirmation: "example")
|
||||
end
|
||||
|
||||
describe "GET #destroy" do
|
||||
|
@ -60,6 +61,17 @@ describe SessionsController, type: :controller do
|
|||
|
||||
expect(@request.session[:user_id]).to be_nil
|
||||
end
|
||||
|
||||
it "should not login user in if account mismatch" do
|
||||
post :create, params: {
|
||||
session: {
|
||||
email: @omni_user.email,
|
||||
password: "example",
|
||||
},
|
||||
}
|
||||
|
||||
expect(@request.session[:user_id]).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET/POST #omniauth" do
|
||||
|
|
Loading…
Reference in New Issue