Commit e914b903 authored by Daniel Gal's avatar Daniel Gal
Browse files

Fixed & refactored guard conditions

parent 5985870e
Pipeline #2196 failed with stages
in 23 seconds
......@@ -7,19 +7,17 @@ from . import models
@partial
def set_display_name(strategy, backend, is_new=False, *args, **kwargs):
if not backend.name == "authsch" and not is_new:
return
display_name = strategy.session_get("displayName", None)
if not display_name:
return redirect("/first-login")
if backend.name == "authsch" and is_new:
display_name = strategy.session_get("displayName", None)
if not display_name:
return redirect("/first-login")
def create_profile(strategy, backend, request, details, user, *args, **kwargs):
if not backend.name == "authsch":
return
try:
user.profile
except exceptions.ObjectDoesNotExist:
display_name = strategy.session_get("displayName", None)
models.Profile.objects.create(user=user, display_name=display_name)
if backend.name == "authsch":
try:
user.profile
except exceptions.ObjectDoesNotExist:
display_name = strategy.session_get("displayName", None)
models.Profile.objects.create(user=user, display_name=display_name)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment