Improve login screen when only OmniAuth providers are enabled
Avoids an empty Sign in box when signup_enabled? is false, and avoids showing "No authentication methods configured" unless there really are none. OmniAuth signin gets its own file for consistency with signin and signup and LDAP.
This commit is contained in:
parent
d785b20c43
commit
252ee4e7e5
3 changed files with 24 additions and 18 deletions
|
@ -1,6 +1,18 @@
|
|||
%div
|
||||
= render 'devise/shared/signin_box'
|
||||
- if signin_enabled? || ldap_enabled?
|
||||
= render 'devise/shared/signin_box'
|
||||
|
||||
- if signup_enabled?
|
||||
-# Omniauth fits between signin/ldap signin and signup and does not have a surrounding box
|
||||
- if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?
|
||||
.clearfix.prepend-top-20
|
||||
= render 'devise/shared/omniauth_box'
|
||||
|
||||
-# Signup only makes sense if you can also sign-in
|
||||
- if signin_enabled? && signup_enabled?
|
||||
.prepend-top-20
|
||||
= render 'devise/shared/signup_box'
|
||||
|
||||
-# Show a message if none of the mechanisms above are enabled
|
||||
- if !signin_enabled? && !ldap_enabled? && !(Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?)
|
||||
%div
|
||||
No authentication methods configured.
|
||||
|
|
10
app/views/devise/shared/_omniauth_box.html.haml
Normal file
10
app/views/devise/shared/_omniauth_box.html.haml
Normal file
|
@ -0,0 +1,10 @@
|
|||
%p
|
||||
%span.light
|
||||
Sign in with
|
||||
- providers = additional_providers
|
||||
- providers.each do |provider|
|
||||
%span.light
|
||||
- if default_providers.include?(provider)
|
||||
= link_to authbutton(provider, 32), omniauth_authorize_path(resource_name, provider)
|
||||
- else
|
||||
= link_to provider.to_s.titleize, omniauth_authorize_path(resource_name, provider), class: "btn"
|
|
@ -24,19 +24,3 @@
|
|||
|
||||
- elsif signin_enabled?
|
||||
= render 'devise/sessions/new_base'
|
||||
- else
|
||||
%div
|
||||
No authentication methods configured.
|
||||
|
||||
- if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?
|
||||
.clearfix.prepend-top-20
|
||||
%p
|
||||
%span.light
|
||||
Sign in with
|
||||
- providers = additional_providers
|
||||
- providers.each do |provider|
|
||||
%span.light
|
||||
- if default_providers.include?(provider)
|
||||
= link_to authbutton(provider, 32), omniauth_authorize_path(resource_name, provider)
|
||||
- else
|
||||
= link_to provider.to_s.titleize, omniauth_authorize_path(resource_name, provider), class: "btn"
|
Loading…
Reference in a new issue