diff --git a/frontend/public/locales/en/common.json b/frontend/public/locales/en/common.json index 47d8d8e20098e7ab59b28b4f58e67c4bc7f870ba..e05cd659ebaac25870f26adde30bb6a169856549 100644 --- a/frontend/public/locales/en/common.json +++ b/frontend/public/locales/en/common.json @@ -11,7 +11,7 @@ "firstName": "First name", "lastName": "Last name", "dateOfBirth": "Date of birth", - "nationalIdNumber": "National ID number", + "nationalIdNumber": "Norwegian national ID number", "roleType": "Role", "roleStartDate": "From", "roleEndDate": "To (including)", @@ -114,13 +114,13 @@ "invitationExpired": "Invitation expired" }, "details": "Details", - "nationalIdNumber": "National ID number", + "nationalIdNumber": "Norwegian national ID number", "validation": { "firstNameRequired": "First name is required", "lastNameRequired": "Last name is required", "dateOfBirthRequired": "Date of birth is required", - "invalidIdNumber": "Invalid national ID number", - "nationalIdNumberRequired": "National ID number required", + "invalidIdNumber": "Invalid Norwegian national ID number", + "nationalIdNumberRequired": "Norwegian national ID number required", "roleTypeRequired": "Role type is required", "roleEndRequired": "Role end date is required", "emailRequired": "E-mail is required", @@ -135,8 +135,8 @@ "startDateMustBeBeforeEndDate": "Start date has to be before end date", "phoneNumberAndCountryCode": "Both country code and phone number must be set", "passportNationalityAndNumber": "Both passport nationality and number need to be set", - "doubleIdentity": "*You have input both national ID and passport. Please choose only one.", - "nationalIdOrPassport": "National ID or passport information need to be entered", + "doubleIdentity": "*You have input both Norwegian national ID and passport. Please choose only one.", + "nationalIdOrPassport": "Norwegian national ID number or passport information need to be entered", "genderIsRequired": "Gender is required" }, "button": { @@ -211,11 +211,11 @@ "invalid_invite": "Invalid invite", "invite_expired": "Invite has expired", "cannot_update_fields": "Failed to update data", - "update_national_id_not_allowed": "Not allowed to update verified national ID", + "update_national_id_not_allowed": "Not allowed to update verified Norwegian ID", "invite_email_failed": "There was a problem sending the invite e-mail. Contact support.", "duplicate_private_email": "There is already a guest with the registered e-mail", "duplicate_private_mobile_number": "There is already a guest with the registered mobile phone number", - "duplicate_private_national_id_number": "There is already a guest with the national ID number given", + "duplicate_private_national_id_number": "There is already a guest with the Norwegian national ID number given", "duplicate_private_passport_number": "There is already a guest with the passport number given" } }, diff --git a/frontend/src/routes/guest/register/index.test.tsx b/frontend/src/routes/guest/register/index.test.tsx index ed7f8d1e3962cf47da24edc6e98134ce82c531df..4969ed4dddb82c1351300f2353f9d1b356072c4a 100644 --- a/frontend/src/routes/guest/register/index.test.tsx +++ b/frontend/src/routes/guest/register/index.test.tsx @@ -44,7 +44,7 @@ const allFeaturesOn = { test('Field showing values correctly', async () => { fetchMock.mockIf('/api/ui/v1/invited/', () => - Promise.resolve<any>(JSON.stringify(testData)), + Promise.resolve<any>(JSON.stringify(testData)) ) render( @@ -54,7 +54,7 @@ test('Field showing values correctly', async () => { <GuestRegister /> </LocalizationProvider> </FeatureContext.Provider> - </BrowserRouter>, + </BrowserRouter> ) await screen.findByDisplayValue(testData.person.first_name) @@ -79,19 +79,19 @@ test('Field showing values correctly', async () => { // TODO Haven't been able to mock getting role types properly yet, so not checking role name // await screen.findByDisplayValue(testData.role.name_en) await screen.findByDisplayValue( - `${testData.role.start} - ${testData.role.end}`, + `${testData.role.start} - ${testData.role.end}` ) // For the default setup the contact person at unit field should be showing await screen.findByDisplayValue(testData.role.contact_person_unit) }) -test('Gender and birth date suggestions not showing if no national ID given', async () => { +test('Gender and birth date suggestions not showing if no Norwegian national ID given', async () => { // Clear the fnr // @ts-ignore testData.person.fnr = null fetchMock.mockIf('/api/ui/v1/invited/', () => - Promise.resolve<any>(JSON.stringify(testData)), + Promise.resolve<any>(JSON.stringify(testData)) ) render( <BrowserRouter> @@ -100,7 +100,7 @@ test('Gender and birth date suggestions not showing if no national ID given', as <GuestRegister /> </LocalizationProvider> </FeatureContext.Provider> - </BrowserRouter>, + </BrowserRouter> ) // Wait a bit so that all the values are showing @@ -117,7 +117,7 @@ test('Gender and birth date suggestions not showing if no national ID given', as }) test('Gender and birth date suggestions not overriding existing values', async () => { - // Make the date of birth and national ID not match + // Make the date of birth and Norwegian national ID not match testData.person.fnr = '08015214555' // @ts-ignore testData.person.date_of_birth = '1960-01-08' @@ -126,7 +126,7 @@ test('Gender and birth date suggestions not overriding existing values', async ( testData.person.gender = 'female' fetchMock.mockIf('/api/ui/v1/invited/', () => - Promise.resolve<any>(JSON.stringify(testData)), + Promise.resolve<any>(JSON.stringify(testData)) ) render( <BrowserRouter> @@ -135,7 +135,7 @@ test('Gender and birth date suggestions not overriding existing values', async ( <GuestRegister /> </LocalizationProvider> </FeatureContext.Provider> - </BrowserRouter>, + </BrowserRouter> ) // In this a date of birth was already set, and it should not have been overridden by a suggestion @@ -146,7 +146,6 @@ test('Gender and birth date suggestions not overriding existing values', async ( await screen.findByDisplayValue('female') }) - test('Gender is remembered when going back', async () => { testData.person.fnr = '' // @ts-ignore @@ -154,7 +153,8 @@ test('Gender is remembered when going back', async () => { testData.person.passport = 'NO-12345678' fetchMock.mockIf('/api/ui/v1/invited/', () => - Promise.resolve<any>(JSON.stringify(testData))) + Promise.resolve<any>(JSON.stringify(testData)) + ) render( <BrowserRouter> @@ -163,7 +163,7 @@ test('Gender is remembered when going back', async () => { <GuestRegister /> </LocalizationProvider> </FeatureContext.Provider> - </BrowserRouter>, + </BrowserRouter> ) // Wait for data to be visible @@ -192,7 +192,8 @@ test('Gender not required when gender field is not shown', async () => { testData.person.passport = 'NO-12345678' fetchMock.mockIf('/api/ui/v1/invited/', () => - Promise.resolve<any>(JSON.stringify(testData))) + Promise.resolve<any>(JSON.stringify(testData)) + ) const genderFieldOff = { displayContactAtUnit: true, @@ -208,7 +209,7 @@ test('Gender not required when gender field is not shown', async () => { <GuestRegister /> </LocalizationProvider> </FeatureContext.Provider> - </BrowserRouter>, + </BrowserRouter> ) // Wait for data to be visible diff --git a/frontend/src/routes/guest/register/steps/register.test.tsx b/frontend/src/routes/guest/register/steps/register.test.tsx index d2eafe6cff7e3735cbcaf533d40cb73b534b2fbc..ad034c1186e352217b3804e7a13ebbc227f4384f 100644 --- a/frontend/src/routes/guest/register/steps/register.test.tsx +++ b/frontend/src/routes/guest/register/steps/register.test.tsx @@ -51,7 +51,7 @@ test('Guest register page showing passport field on manual registration', async initialGuestData={getEmptyGuestData()} registerData={null} /> - </LocalizationProvider>, + </LocalizationProvider> ) await waitFor(() => { @@ -76,7 +76,7 @@ test('Name not editable if present and invite is Feide', async () => { initialGuestData={testData} registerData={null} /> - </LocalizationProvider>, + </LocalizationProvider> ) await waitFor(() => { @@ -100,7 +100,7 @@ test('Name editable if missing and invite is Feide', async () => { initialGuestData={testData} registerData={null} /> - </LocalizationProvider>, + </LocalizationProvider> ) await waitFor(() => { @@ -109,7 +109,7 @@ test('Name editable if missing and invite is Feide', async () => { }) }) -test('Identifier fields disabled if invite is Feide and national ID present', async () => { +test('Identifier fields disabled if invite is Feide and Norwegian national ID number present', async () => { const nextHandler = (registerData: GuestRegisterData) => { console.log(`Entered data: ${registerData}`) } @@ -125,7 +125,7 @@ test('Identifier fields disabled if invite is Feide and national ID present', as initialGuestData={testData} registerData={null} /> - </LocalizationProvider>, + </LocalizationProvider> ) await waitFor(() => { @@ -135,7 +135,7 @@ test('Identifier fields disabled if invite is Feide and national ID present', as }) }) -test('Identifier fields enabled if invite is Feide but national ID number missing', async () => { +test('Identifier fields enabled if invite is Feide but Norwegian national ID number missing', async () => { const nextHandler = (registerData: GuestRegisterData) => { console.log(`Entered data: ${registerData}`) } @@ -151,7 +151,7 @@ test('Identifier fields enabled if invite is Feide but national ID number missin initialGuestData={testData} registerData={null} /> - </LocalizationProvider>, + </LocalizationProvider> ) await waitFor(() => { @@ -177,7 +177,7 @@ test('Identifier fields disabled and name fields enabled if invite is ID-porten' initialGuestData={testData} registerData={null} /> - </LocalizationProvider>, + </LocalizationProvider> ) await waitFor(() => { @@ -223,14 +223,14 @@ test('Gender required to be set if gender field is showing', async () => { ref={reference} /> </LocalizationProvider> - </FeatureContext.Provider>, + </FeatureContext.Provider> ) reference.current?.doSubmit() // The validation should fail for gender since to value has been set const validationMessage = await waitFor(() => - screen.getByText('validation.genderIsRequired'), + screen.getByText('validation.genderIsRequired') ) expect(validationMessage).toBeInTheDocument() }) @@ -276,19 +276,19 @@ test('Gender not required to be set if gender field is not showing', async () => ref={reference} /> </LocalizationProvider> - </FeatureContext.Provider>, + </FeatureContext.Provider> ) reference.current?.doSubmit() await waitFor( () => { expect( - screen.queryByText('validation.genderIsRequired'), + screen.queryByText('validation.genderIsRequired') ).not.toBeInTheDocument() }, { timeout: 5000, - }, + } ) }) @@ -328,7 +328,7 @@ test('Guest not allowed to proceed in wizard if phone number is not valid', asyn ref={reference} /> </LocalizationProvider> - </FeatureContext.Provider>, + </FeatureContext.Provider> ) await act(async () => reference.current?.doSubmit()) @@ -372,7 +372,7 @@ test('Guest allowed to proceed in wizard if data is valid', async () => { ref={reference} /> </LocalizationProvider> - </FeatureContext.Provider>, + </FeatureContext.Provider> ) await act(async () => reference.current?.doSubmit()) @@ -385,7 +385,6 @@ test('Default country code gets set in form values', async () => { let guestRegisterData: GuestRegisterData | null = null const nextHandler = (registerData: GuestRegisterData) => { guestRegisterData = registerData - } // Leave the mobile phone country code blank, it should @@ -423,7 +422,7 @@ test('Default country code gets set in form values', async () => { ref={reference} /> </LocalizationProvider> - </FeatureContext.Provider>, + </FeatureContext.Provider> ) expect(guestRegisterData).toBeNull() @@ -433,16 +432,13 @@ test('Default country code gets set in form values', async () => { expect(guestRegisterData.mobilePhoneCountry).toEqual('NO') }) - test('Foreign country code gets set in form values', async () => { // This stores the data sent from the form when the user clicks submit let guestRegisterData: GuestRegisterData | null = null const nextHandler = (registerData: GuestRegisterData) => { guestRegisterData = registerData - } - const formData: GuestRegisterData = { firstName: 'Test', lastName: 'Test2', @@ -466,7 +462,6 @@ test('Foreign country code gets set in form values', async () => { }, } - render( <FeatureContext.Provider value={allFeaturesOn}> <LocalizationProvider dateAdapter={AdapterDateFns}> @@ -477,7 +472,7 @@ test('Foreign country code gets set in form values', async () => { ref={reference} /> </LocalizationProvider> - </FeatureContext.Provider>, + </FeatureContext.Provider> ) const countryCodeInput = screen.getByTestId('phone-country-code-select-inner') diff --git a/frontend/src/routes/guest/register/steps/register.tsx b/frontend/src/routes/guest/register/steps/register.tsx index d9db88a4668b273caed13e6c2122424975dfd782..3d5a564cc78ff80d1857a88b3ac078fb75619b69 100644 --- a/frontend/src/routes/guest/register/steps/register.tsx +++ b/frontend/src/routes/guest/register/steps/register.tsx @@ -97,7 +97,7 @@ const GuestRegisterStep = forwardRef( }) // If there is no already a date of birth set, add a suggestion for - // this value based on the national ID, if it is set + // this value based on the Norwegian ID, if it is set if ( (!registerData || !registerData.dateOfBirth) && !initialGuestData.date_of_birth && @@ -149,7 +149,7 @@ const GuestRegisterStep = forwardRef( !data.passportNumber && !data.passportNationality ) { - // The user has not entered a national ID number nor passport information. + // The user has not entered a Norwegian national ID number nor passport information. // In this case the user should not be allowed to send in the registration setIdErrorState(t('validation.nationalIdOrPassport')) return @@ -272,7 +272,7 @@ const GuestRegisterStep = forwardRef( if (registerData?.gender) { // Need to set gender in the state and also in the form. This is // to handle the case where the gender is suggested by the - // national ID number + // Norwegian national ID number setValue('gender', registerData.gender) setGender(registerData.gender) } @@ -313,7 +313,7 @@ const GuestRegisterStep = forwardRef( inviteOrIdPorten || initialGuestData.first_name.length === 0, allowLastNameEditable: inviteOrIdPorten || initialGuestData.last_name.length === 0, - // If there is a national ID number (presumably from Feide or ID porten), + // If there is a Norwegian national ID number (presumably from Feide or ID porten), // already present, then do not allow the user to change the data // in the identifier fields disableIdentifierFields: @@ -575,17 +575,17 @@ const GuestRegisterStep = forwardRef( </Typography> <Typography> <Trans i18nKey="common:guestRegisterWizardText.identityBody"> - Enter national identity number if you have one. + Enter Norwegian identity number if you have one. <strong>Otherwise</strong> use passport information. </Trans> </Typography> <Divider sx={{ marginBottom: '1rem', border: '1px solid' }} /> - {/* The guest should fill in one of national ID number or passport number */} + {/* The guest should fill in one of Norwegian national ID number or passport number */} <Controller name="nationalIdNumber" control={control} rules={{ - // It is not required that the national ID number be filled in, the guest may not have + // It is not required that the Norwegian national ID number be filled in, the guest may not have // one, so allow empty values for the validation to pass. Note that both "fødselsnummer" and // D-number are allowed as input validate: (value) => isValidFnr(value, true), diff --git a/greg/management/commands/populate_test_data.py b/greg/management/commands/populate_test_data.py index f978003624786d70ed7c9daf69864f8d5965ef81..10272594405874d0009c00976a3edcef6aa62803 100644 --- a/greg/management/commands/populate_test_data.py +++ b/greg/management/commands/populate_test_data.py @@ -282,7 +282,7 @@ class DatabasePopulation: def _add_active_person(self): """ - A person with an active role and a verified identity of type national id or + A person with an active role and a verified identity of type Norwegian national ID number or passport. """ adam = Person.objects.create( @@ -351,8 +351,8 @@ class DatabasePopulation: def _add_expired_person(self): """ - A person with an inactive role, and a verified identity of type national id or - passport. + A person with an inactive role, and a verified identity of type + Norwegian national ID number or passport. """ esther = Person.objects.create( first_name="Esther", diff --git a/greg/managers.py b/greg/managers.py index 30848d3a749143a58404ab0d941ee276e64bfacc..655bee8227e08e8d7f197f54ec9627949aed4f95 100644 --- a/greg/managers.py +++ b/greg/managers.py @@ -3,7 +3,7 @@ from django.db.models import Count, Manager, QuerySet class PersonQuerySet(QuerySet): def count_verified_identities(self): - # the requirement is minimum one verified passport or national ID number + # the requirement is minimum one verified passport or Norwegian national ID number # TODO: should we make this configurable or simply outsource the logic # to the systems consuming this data? return Count( diff --git a/greg/models.py b/greg/models.py index c7c8c369bfcad657673885e8e08ea09758228f4b..425f08a5ae98b635bb5459ac534dc51e58adc901 100644 --- a/greg/models.py +++ b/greg/models.py @@ -134,7 +134,7 @@ class Person(BaseModel): Due to the diversity of guests at a university institution, there are many ways for guests to identify themselves. These include Feide ID, passport number, driver's license - and national ID card. + and Norwegian national ID number card. Some of these methods are implicitly trusted (Feide ID) because the guest is likely a visitor from another academic institution diff --git a/greg/tests/api/test_person.py b/greg/tests/api/test_person.py index dc411637cd75d2856c0ae0334816e64fb3884fd1..628977d1c0da8d40be4b8911599c3e82c39a0045 100644 --- a/greg/tests/api/test_person.py +++ b/greg/tests/api/test_person.py @@ -696,5 +696,5 @@ def test_identity_post_fails_if_duplicate(client, person, person_foo): reverse("v1:person_identity-list", kwargs={"person_id": person.id}) ) results = response.json()["results"] - # No national ID should have been added + # No Norwegian national ID should have been added assert len(results) == 0 diff --git a/greg/utils.py b/greg/utils.py index 1afb6f20868692dc182eafb561eb94b0df43dbae..0a49931fdcdf6650b01f3d34832437c8b0c2ba44 100644 --- a/greg/utils.py +++ b/greg/utils.py @@ -14,7 +14,7 @@ def camel_to_snake(s: str) -> str: def is_valid_id_number(input_digits: str) -> bool: """ - Checks whether the input represents a valid national ID number (fødselsnummer) or a valid D-number. + Checks whether the input represents a valid Norwegian national ID number (fødselsnummer) or a valid D-number. """ is_dnumber = int(input_digits[0:1]) >= 4 return is_valid_norwegian_national_id_number(input_digits, is_dnumber) @@ -22,7 +22,7 @@ def is_valid_id_number(input_digits: str) -> bool: def is_valid_norwegian_national_id_number(input_digits: str, is_dnumber: bool) -> bool: """ - Checks whether input_digits is a valid national ID number or D-number. + Checks whether input_digits is a valid Norwegian national ID number or D-number. It is based on the code found here: https://github.com/navikt/fnrvalidator/blob/master/src/validator.js diff --git a/gregui/api/views/invitation.py b/gregui/api/views/invitation.py index f6e94dc0f4647cd91fda17e5d9dd770756c42f90..05a899c397339bb3fc95a560685bd3798dc03f42 100644 --- a/gregui/api/views/invitation.py +++ b/gregui/api/views/invitation.py @@ -283,7 +283,7 @@ class InvitedGuestView(GenericAPIView): # If the user is not logged in then tell the client to take him through the manual registration process return SessionType.INVITE if person.fnr and person.fnr.source == "idporten": - # If the user has logged in through ID-porten the national ID number should have been + # If the user has logged in through ID-porten the Norwegian national ID number should have been # added to the person at this stage return SessionType.ID_PORTEN if person.feide_id: @@ -359,7 +359,7 @@ class InvitedGuestView(GenericAPIView): status=status.HTTP_400_BAD_REQUEST, data={ "code": "update_national_id_not_allowed", - "message": "Not allowed to update verified national ID", + "message": "Not allowed to update verified Norwegian ID", }, ) @@ -367,7 +367,7 @@ class InvitedGuestView(GenericAPIView): # There will always be a name for a user in Feide feide_id = self._get_identity_or_none(person, Identity.IdentityType.FEIDE_ID) - # It is not certain that all fields required will come from Feide, like the national ID number, so + # It is not certain that all fields required will come from Feide, like the Norwegian national ID number, so # allow updates to empty fields to handle the case where the information is missing from Feide # and the user has to enter it manually illegal_fields = self._illegal_updates( @@ -405,7 +405,7 @@ class InvitedGuestView(GenericAPIView): changed_field in ("first_name", "last_name") and session_type == SessionType.ID_PORTEN ): - # From ID-porten only the national ID-number is given, so the name must be what the + # From ID-porten only the Norwegian ID-number is given, so the name must be what the # sponsor wrote, and can be changed continue diff --git a/gregui/tests/api/views/test_invitation.py b/gregui/tests/api/views/test_invitation.py index 81fd90d60206a83c015f3209e28ca3d3cff22b2d..3e0d7929270ed190574fca6d7b3869e9aa6d47d3 100644 --- a/gregui/tests/api/views/test_invitation.py +++ b/gregui/tests/api/views/test_invitation.py @@ -779,7 +779,7 @@ def test_duplicate_national_id( value=fnr, ) - # Try to respond to an invite with a national ID number that already exists + # Try to respond to an invite with a Norwegian national ID number that already exists data = { "person": { "private_mobile": "+4797543992", @@ -802,5 +802,5 @@ def test_duplicate_national_id( assert response_data["code"] == "duplicate_private_national_id_number" person.refresh_from_db() - # The national ID number should still be not set since the post request failed + # The Norwegian national ID number should still be not set since the post request failed assert person.fnr is None