Skip to content

Commit

Permalink
Fix tunnistamo login (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezkat authored Aug 26, 2024
1 parent 91595be commit ccd835d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions respa/providers/turku_oidc/adapter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
from helusers.adapter import DefaultSocialAccountAdapter
from helusers.user_utils import update_user
from helusers.user_utils import update_user as _update_user
from helusers.utils import username_to_uuid
from django.utils import timezone
from users.models import User, LoginMethod

from users.models import User


def update_user(user, payload, oidc=False):
amr = payload.pop('amr', None)
if amr:
user.amr, _ = LoginMethod.objects.get_or_create(id=amr)
user.last_login = timezone.now()
user.save()
return _update_user(user, payload, oidc)

class SocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
Expand Down

0 comments on commit ccd835d

Please sign in to comment.