Skip to content
Snippets Groups Projects
Commit b4467581 authored by Tore.Brede's avatar Tore.Brede
Browse files

GREG-85: Fixing problem with wrong data inserted into response

parent 094594b7
No related branches found
No related tags found
1 merge request!113GREG-85: Guest registration page
Pipeline #97524 failed
...@@ -61,6 +61,8 @@ export default function GuestRegister() { ...@@ -61,6 +61,8 @@ export default function GuestRegister() {
if (response.ok) { if (response.ok) {
response.json().then((jsonResponse) => { response.json().then((jsonResponse) => {
console.log(`Guest data from server: ${JSON.stringify(jsonResponse)}`)
const authenticationMethod = const authenticationMethod =
jsonResponse.meta.form_type === 'manual' jsonResponse.meta.form_type === 'manual'
? AuthenticationMethod.NationalIdNumberOrPassport ? AuthenticationMethod.NationalIdNumberOrPassport
......
import json import json
import datetime import datetime
from uuid import uuid4 from uuid import uuid4
from django.contrib.auth.models import AnonymousUser
from django.core import exceptions from django.core import exceptions
from django.db import transaction from django.db import transaction
from django.http.response import JsonResponse from django.http.response import JsonResponse
...@@ -133,11 +135,12 @@ class InvitedGuestView(GenericAPIView): ...@@ -133,11 +135,12 @@ class InvitedGuestView(GenericAPIView):
sponsor = role.sponsor_id sponsor = role.sponsor_id
# If the user is not logged in then tell the client to take him through the manual registration process # 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 fnr_verified = False
try: 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 # TODO Maybe other criteria should be specified here
if fnr.verified == Identity.Verified.AUTOMATIC: if fnr.verified == Identity.Verified.AUTOMATIC:
fnr_verified = True fnr_verified = True
...@@ -155,7 +158,7 @@ class InvitedGuestView(GenericAPIView): ...@@ -155,7 +158,7 @@ class InvitedGuestView(GenericAPIView):
"last_name": person.last_name, "last_name": person.last_name,
"email": person.private_email and person.private_email.value, "email": person.private_email and person.private_email.value,
"mobile_phone": person.private_mobile and person.private_mobile.value, "mobile_phone": person.private_mobile and person.private_mobile.value,
"fnr": fnr and fnr.value, "fnr": fnr,
"passport": passport, "passport": passport,
}, },
"sponsor": { "sponsor": {
...@@ -172,7 +175,7 @@ class InvitedGuestView(GenericAPIView): ...@@ -172,7 +175,7 @@ class InvitedGuestView(GenericAPIView):
"comments": role.comments, "comments": role.comments,
}, },
"meta": { "meta": {
"form_type": is_not_logged_in, "form_type": "manual" if is_not_logged_in else "feide",
"fnr_verified": fnr_verified, "fnr_verified": fnr_verified,
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment