diff --git a/frontend/src/routes/guest/register/index.tsx b/frontend/src/routes/guest/register/index.tsx index b50611a6eeff38db27fc9c6866d848883e204ba5..8dc410bedb1617887482feb7b9f5dbce7bfe90f6 100644 --- a/frontend/src/routes/guest/register/index.tsx +++ b/frontend/src/routes/guest/register/index.tsx @@ -61,6 +61,8 @@ export default function GuestRegister() { if (response.ok) { response.json().then((jsonResponse) => { + console.log(`Guest data from server: ${JSON.stringify(jsonResponse)}`) + const authenticationMethod = jsonResponse.meta.form_type === 'manual' ? AuthenticationMethod.NationalIdNumberOrPassport diff --git a/gregui/api/views/invitation.py b/gregui/api/views/invitation.py index f356a035be8f514ddc562a3a0a33bee34f312427..c1d91fef660987521778a857ae7dc49bef2e53ec 100644 --- a/gregui/api/views/invitation.py +++ b/gregui/api/views/invitation.py @@ -1,6 +1,8 @@ import json import datetime from uuid import uuid4 + +from django.contrib.auth.models import AnonymousUser from django.core import exceptions from django.db import transaction from django.http.response import JsonResponse @@ -133,11 +135,12 @@ class InvitedGuestView(GenericAPIView): sponsor = role.sponsor_id # If the user is not logged in then tell the client to take him through the manual registration process - is_not_logged_in = request.user + is_not_logged_in = request.user.is_anonymous fnr_verified = False try: - fnr = person.identities.get(type=Identity.IdentityType.NORWEGIAN_NATIONAL_ID_NUMBER) + fnr_identity = person.identities.get(type=Identity.IdentityType.NORWEGIAN_NATIONAL_ID_NUMBER) + fnr = fnr_identity.value # TODO Maybe other criteria should be specified here if fnr.verified == Identity.Verified.AUTOMATIC: fnr_verified = True @@ -155,7 +158,7 @@ class InvitedGuestView(GenericAPIView): "last_name": person.last_name, "email": person.private_email and person.private_email.value, "mobile_phone": person.private_mobile and person.private_mobile.value, - "fnr": fnr and fnr.value, + "fnr": fnr, "passport": passport, }, "sponsor": { @@ -172,7 +175,7 @@ class InvitedGuestView(GenericAPIView): "comments": role.comments, }, "meta": { - "form_type": is_not_logged_in, + "form_type": "manual" if is_not_logged_in else "feide", "fnr_verified": fnr_verified, } }