diff --git a/frontend/src/routes/guest/register/guestDataForm.ts b/frontend/src/routes/guest/register/guestDataForm.ts index 7c7394db526b96eeefe80e67fa293018f42e2020..75d0307fcbe0c2c4f87afef12bd39ca7e51109cf 100644 --- a/frontend/src/routes/guest/register/guestDataForm.ts +++ b/frontend/src/routes/guest/register/guestDataForm.ts @@ -23,4 +23,5 @@ export type ContactInformationBySponsor = { passport?: string user_information_source: AuthenticationMethod + fnr_verified: boolean } diff --git a/frontend/src/routes/guest/register/index.tsx b/frontend/src/routes/guest/register/index.tsx index 497a7f66bab9c195b24edd1ab017eb7252ea84e0..b50611a6eeff38db27fc9c6866d848883e204ba5 100644 --- a/frontend/src/routes/guest/register/index.tsx +++ b/frontend/src/routes/guest/register/index.tsx @@ -52,6 +52,7 @@ export default function GuestRegister() { fnr: '', passport: '', user_information_source: AuthenticationMethod.Feide, + fnr_verified: false, }) const guestContactInfo = async () => { @@ -60,8 +61,12 @@ export default function GuestRegister() { if (response.ok) { response.json().then((jsonResponse) => { - // TODO Set up so that information about the authentication method is included in the response from the server (if the user is logged in by Feide) - const userSource = AuthenticationMethod.NationalIdNumberOrPassport + const authenticationMethod = + jsonResponse.meta.form_type === 'manual' + ? AuthenticationMethod.NationalIdNumberOrPassport + : AuthenticationMethod.Feide + + const fnrVerified = jsonResponse.meta.fnr_verified === true setGuestFormData({ first_name: jsonResponse.person.first_name, @@ -79,7 +84,8 @@ export default function GuestRegister() { fnr: jsonResponse.fnr, passport: jsonResponse.passport, - user_information_source: userSource, + user_information_source: authenticationMethod, + fnr_verified: fnrVerified, }) }) } diff --git a/gregui/api/views/invitation.py b/gregui/api/views/invitation.py index c6e893df7805af51457620859f777011bb5dfa0f..f356a035be8f514ddc562a3a0a33bee34f312427 100644 --- a/gregui/api/views/invitation.py +++ b/gregui/api/views/invitation.py @@ -19,7 +19,6 @@ from greg.permissions import IsSponsor from gregui.api.serializers.guest import GuestRegisterSerializer from gregui.api.serializers.invitation import InviteGuestSerializer - from gregui.models import GregUserProfile @@ -133,6 +132,9 @@ class InvitedGuestView(GenericAPIView): person = role.person 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 + fnr_verified = False try: fnr = person.identities.get(type=Identity.IdentityType.NORWEGIAN_NATIONAL_ID_NUMBER) @@ -170,7 +172,8 @@ class InvitedGuestView(GenericAPIView): "comments": role.comments, }, "meta": { - "fnr_verified": fnr_verified + "form_type": is_not_logged_in, + "fnr_verified": fnr_verified, } } return JsonResponse(data=data, status=status.HTTP_200_OK)