forked from External/greenlight
GRN-80: Patch for fixing the added function in a production environment (#444)
* Patch for fixing the added function in a production environment * Rubocop!
This commit is contained in:
parent
88f408c092
commit
c07cfd0d93
|
@ -76,12 +76,16 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def allow_greenlight_accounts?
|
def allow_greenlight_accounts?
|
||||||
return true unless Rails.configuration.loadbalanced_configuration
|
return Rails.configuration.allow_user_signup unless Rails.configuration.loadbalanced_configuration
|
||||||
return false unless Rails.configuration.allow_user_signup
|
return false unless Rails.configuration.allow_user_signup
|
||||||
# No need to retrieve the provider info if the provider is whitelisted
|
# No need to retrieve the provider info if the provider is whitelisted
|
||||||
return true if launcher_allow_user_signup_whitelisted?(@user_domain)
|
return true if launcher_allow_user_signup_whitelisted?(@user_domain)
|
||||||
# Proceed with retrieving the provider info
|
# Proceed with retrieving the provider info
|
||||||
provider_info = retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials')
|
begin
|
||||||
provider_info['provider'] == 'greenlight'
|
provider_info = retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials')
|
||||||
|
provider_info['provider'] == 'greenlight'
|
||||||
|
rescue
|
||||||
|
false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,21 +55,22 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
<% allow_greenlight_accounts = allow_greenlight_accounts? %>
|
||||||
<% if Rails.configuration.omniauth_ldap %>
|
<% if Rails.configuration.omniauth_ldap %>
|
||||||
<%= link_to t("login"), omniauth_login_url(:ldap), :class => "btn btn-pill btn-outline-primary mx-2" %>
|
<%= link_to t("login"), omniauth_login_url(:ldap), :class => "btn btn-pill btn-outline-primary mx-2" %>
|
||||||
<% elsif allow_greenlight_accounts? %>
|
<% elsif allow_greenlight_accounts %>
|
||||||
<%= link_to t("login"), "#loginModal", :class => "btn btn-pill btn-outline-primary mx-2", "data-toggle": "modal" %>
|
<%= link_to t("login"), "#loginModal", :class => "btn btn-pill btn-outline-primary mx-2", "data-toggle": "modal" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to t("login"), omniauth_login_url(:bn_launcher), :class => "btn btn-pill btn-outline-primary mx-2" %>
|
<%= link_to t("login"), omniauth_login_url(:bn_launcher), :class => "btn btn-pill btn-outline-primary mx-2" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if allow_user_signup? && allow_greenlight_accounts? %>
|
<% if allow_user_signup? && allow_greenlight_accounts %>
|
||||||
<%= link_to t("signup.title"), signup_path, :class => "btn btn-pill btn-outline-primary mx-2" %>
|
<%= link_to t("signup.title"), signup_path, :class => "btn btn-pill btn-outline-primary mx-2" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "shared/modals/login_modal" %>
|
<%= render "shared/modals/login_modal" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue