forked from External/greenlight
GRN-80: Allow local accounts on multitenant (#428)
* Changed the way the omniauth providers are declared * Allow local authentication for multitenant mode based on customer settings * Cleanead up code mandated by rubocop * Completed implementation for signin and added the one for signup * Fixed issue with rubocop * Renamed customer_name to lb_user * Renamed lb_user -> user_domain, fixed issue with signup controller, email verification WAS NOT implemented * Completed implementation of email_verification * Fixed rubocop issue * Final update * Fix for test with loadbalancer * Make sure loadbalancer mockup is only used when env defined * Fix for test on rooms_controller * Fixed most of the test failing on multitenant env * Fixed issue detected by rubocop * Fixed issue with activation tockens not working on resend * Fixed new issue found by rubocop * Updated travis script * Harcoded credentials for mockup * Updated expectation on start_session * Fixed issue with duplication of home room * Updated script for rubocop * Restored Gemfile
This commit is contained in:
@ -27,18 +27,13 @@ class SessionsController < ApplicationController
|
||||
|
||||
# POST /users/login
|
||||
def create
|
||||
user = User.find_by(email: session_params[:email])
|
||||
if user && !user.greenlight_account?
|
||||
redirect_to root_path, alert: I18n.t("invalid_login_method")
|
||||
elsif user.try(:authenticate, session_params[:password])
|
||||
if user.email_verified
|
||||
login(user)
|
||||
else
|
||||
redirect_to(account_activation_path(email: user.email)) && return
|
||||
end
|
||||
else
|
||||
redirect_to root_path, alert: I18n.t("invalid_credentials")
|
||||
end
|
||||
user = User.find_by(email: session_params[:email], provider: @user_domain)
|
||||
redirect_to(root_path, alert: I18n.t("invalid_user")) && return unless user
|
||||
redirect_to(root_path, alert: I18n.t("invalid_login_method")) && return unless user.greenlight_account?
|
||||
redirect_to(root_path, alert: I18n.t("invalid_credentials")) && return unless user.try(:authenticate,
|
||||
session_params[:password])
|
||||
redirect_to(account_activation_path(email: user.email)) && return unless user.activated?
|
||||
login(user)
|
||||
end
|
||||
|
||||
# GET/POST /auth/:provider/callback
|
||||
|
Reference in New Issue
Block a user