Skip to content

Commit

Permalink
add DD_SOCIAL_LOGIN_AUTO_REDIRECT
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik committed May 15, 2021
1 parent c554323 commit c5a25a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dojo/settings/settings.dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
DD_CREDENTIAL_AES_256_KEY=(str, '.'),
DD_DATA_UPLOAD_MAX_MEMORY_SIZE=(int, 8388608), # Max post size set to 8mb
DD_SOCIAL_AUTH_SHOW_LOGIN_FORM=(bool, True), # do we show user/pass input
DD_SOCIAL_LOGIN_AUTO_REDIRECT=(bool, False), # auto-redirect if there is only one social login method
DD_SOCIAL_AUTH_TRAILING_SLASH=(bool, True),
DD_SOCIAL_AUTH_AUTH0_OAUTH2_ENABLED=(bool, False),
DD_SOCIAL_AUTH_AUTH0_KEY=(str, ''),
Expand Down Expand Up @@ -392,6 +393,7 @@ def generate_url(scheme, double_slashes, user, password, host, port, path, param
CLASSIC_AUTH_ENABLED = True
# Showing login form (form is not needed for external auth: OKTA, Google Auth, etc.)
SHOW_LOGIN_FORM = env('DD_SOCIAL_AUTH_SHOW_LOGIN_FORM')
SOCIAL_LOGIN_AUTO_REDIRECT = env('DD_SOCIAL_LOGIN_AUTO_REDIRECT')

SOCIAL_AUTH_STRATEGY = 'social_django.strategy.DjangoStrategy'
SOCIAL_AUTH_STORAGE = 'social_django.models.DjangoStorage'
Expand Down
2 changes: 1 addition & 1 deletion dojo/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def api_v2_key(request):


def login_view(request):
if not settings.SHOW_LOGIN_FORM and sum([
if not settings.SHOW_LOGIN_FORM and settings.SOCIAL_LOGIN_AUTO_REDIRECT and sum([
settings.GOOGLE_OAUTH_ENABLED,
settings.OKTA_OAUTH_ENABLED,
settings.AZUREAD_TENANT_OAUTH2_ENABLED,
Expand Down

0 comments on commit c5a25a9

Please sign in to comment.