Skip to content
Snippets Groups Projects
Commit 21a9d25e authored by Gelencsér Ákos's avatar Gelencsér Ákos :alien:
Browse files

fix: iodc login errors

parent 6990bc5c
Branches
Tags
1 merge request!15Many stuff
Pipeline #48874 passed with warnings
from mozilla_django_oidc.auth import OIDCAuthenticationBackend
from account import models
from common.email import registration
class JSOIDCAuthBackend(OIDCAuthenticationBackend):
......@@ -7,6 +9,10 @@ class JSOIDCAuthBackend(OIDCAuthenticationBackend):
user.first_name = claims.get('given_name', '')
user.last_name = claims.get('family_name', '')
user.save()
models.Profile.objects.create(user=user)
if user.email is not None:
registration.delay(
{'last_name': user.last_name, 'first_name': user.first_name, 'email': user.email})
return user
def update_user(self, user, claims):
......
......@@ -128,7 +128,7 @@ AUTH_PASSWORD_VALIDATORS = [
AUTHENTICATION_BACKENDS = [
'backend.oidc_auth.JSOIDCAuthBackend',
'kszkepzes.oidc_auth.JSOIDCAuthBackend',
]
......@@ -157,7 +157,7 @@ OIDC_RP_SIGN_ALGO = os.environ.get('OIDC_SIGN_ALGO', 'RS256')
OIDC_EXEMPT_URLS = ["/healthz/", "/admin/", "/oidc/"]
LOGIN_REDIRECT_URL = "/"
LOGOUT_REDIRECT_URL = "/"
OIDC_USERNAME_ALGO = 'backend.oidc_auth.generate_username'
OIDC_USERNAME_ALGO = 'kszkepzes.oidc_auth.generate_username'
# Internationalization
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment