From e0afcdec2381ac62ca2e8fab7d5068e26a0a90e4 Mon Sep 17 00:00:00 2001 From: farhatahmad <35435341+farhatahmad@users.noreply.github.com> Date: Wed, 31 Jul 2019 11:35:43 -0400 Subject: [PATCH] GRN2-xx: Added back fix for ldap image and fixed issue with ldap redirect (Fixed #712) (#711) * Added back fix for ldap image * Fixed issue with ldap redirect --- app/controllers/users_controller.rb | 8 +++++++- app/models/user.rb | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 1dd7267f..7303788a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -71,7 +71,13 @@ class UsersController < ApplicationController providers = configured_providers if (!allow_user_signup? || !allow_greenlight_accounts?) && providers.count == 1 && !Rails.configuration.loadbalanced_configuration - return redirect_to "#{Rails.configuration.relative_url_root}/auth/#{providers.first}" + provider_path = if Rails.configuration.omniauth_ldap + ldap_signin_path + else + "#{Rails.configuration.relative_url_root}/auth/#{providers.first}" + end + + return redirect_to provider_path end end diff --git a/app/models/user.rb b/app/models/user.rb index 302bafd6..f3426fe2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -58,7 +58,7 @@ class User < ApplicationRecord u.name = auth_name(auth) unless u.name u.username = auth_username(auth) unless u.username u.email = auth_email(auth) - u.image = auth_image(auth) + u.image = auth_image(auth) unless u.image u.email_verified = true u.save! end