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
|
# POST /users/login
|
||||||
def create
|
def create
|
||||||
user = User.find_by(email: session_params[:email])
|
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)
|
login(user)
|
||||||
else
|
else
|
||||||
redirect_to root_path, notice: I18n.t("invalid_credentials")
|
redirect_to root_path, notice: I18n.t("invalid_credentials")
|
||||||
|
|
|
@ -67,6 +67,7 @@ en:
|
||||||
home_room: Home Room
|
home_room: Home Room
|
||||||
info_update_success: Information successfully updated.
|
info_update_success: Information successfully updated.
|
||||||
invalid_credentials: Login failed due to invalid credentials. Are you sure you entered them correctly?
|
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:"
|
invite_message: "To invite someone to the meeting, send them this link:"
|
||||||
landing:
|
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."
|
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
|
describe SessionsController, type: :controller do
|
||||||
before(:all) 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
|
end
|
||||||
|
|
||||||
describe "GET #destroy" do
|
describe "GET #destroy" do
|
||||||
|
@ -60,6 +61,17 @@ describe SessionsController, type: :controller do
|
||||||
|
|
||||||
expect(@request.session[:user_id]).to be_nil
|
expect(@request.session[:user_id]).to be_nil
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe "GET/POST #omniauth" do
|
describe "GET/POST #omniauth" do
|
||||||
|
|
Loading…
Reference in New Issue