diff --git a/platform/app/src/routes/Register/Register.tsx b/platform/app/src/routes/Register/Register.tsx index 7c0bb4a42..a75ee0556 100644 --- a/platform/app/src/routes/Register/Register.tsx +++ b/platform/app/src/routes/Register/Register.tsx @@ -324,7 +324,8 @@ const RegisterPage = () => { /> { expect(request.tenantId).toBe('tenant-from-session'); expect(request).not.toHaveProperty('code'); }); + + it('normalizes a blank license number for the public registration API', () => { + const request = createRegistrationRequest({ + tenantId: 'tenant-from-session', + firstName: 'Grace', + lastName: 'Hopper', + email: 'grace@example.com', + password: 'Strong!Password', + licenseNo: ' ', + specialty: 'radiology', + turnstileToken: 'turnstile-proof', + policyAcceptances: [ + { policyKey: 'TERMS_OF_SERVICE', version: 'terms-v1' }, + { policyKey: 'PRIVACY_POLICY', version: 'privacy-v1' }, + ], + }); + + expect(request.licenseNo).toBe(''); + }); }); diff --git a/platform/app/src/routes/Register/registrationValidation.test.ts b/platform/app/src/routes/Register/registrationValidation.test.ts index b91eb4617..81a55ef8d 100644 --- a/platform/app/src/routes/Register/registrationValidation.test.ts +++ b/platform/app/src/routes/Register/registrationValidation.test.ts @@ -20,6 +20,11 @@ describe('getRegistrationValidationMessage', () => { expect(getRegistrationValidationMessage(validRegistration)).toBeNull(); }); + it('accepts an omitted public-registration license number', () => { + expect(getRegistrationValidationMessage({ ...validRegistration, licenseNo: '' })).toBeNull(); + expect(getRegistrationValidationMessage({ ...validRegistration, licenseNo: ' ' })).toBeNull(); + }); + it('rejects invalid email and mismatched passwords clearly', () => { expect(getRegistrationValidationMessage({ ...validRegistration, email: 'not-an-email' })).toBe( 'Please enter a valid email address.' @@ -81,6 +86,12 @@ describe('getRegistrationValidationMessage', () => { lastName: 'y', }) ).toBe('First and last name together must be 100 characters or fewer.'); + expect( + getRegistrationValidationMessage({ + ...validRegistration, + licenseNo: 'x'.repeat(101), + }) + ).toBe('License number must be 100 characters or fewer.'); expect( getRegistrationValidationMessage({ ...validRegistration, diff --git a/platform/app/src/routes/Register/registrationValidation.ts b/platform/app/src/routes/Register/registrationValidation.ts index 5e90097d1..21bde5dbe 100644 --- a/platform/app/src/routes/Register/registrationValidation.ts +++ b/platform/app/src/routes/Register/registrationValidation.ts @@ -53,7 +53,6 @@ export const getRegistrationValidationMessage = ({ !email.trim() || !firstName.trim() || !lastName.trim() || - !licenseNo.trim() || !specialty.trim() || !password || !confirmPassword diff --git a/platform/app/src/routes/Settings/Settings.tsx b/platform/app/src/routes/Settings/Settings.tsx index 0a365bf7b..8a95dec5a 100644 --- a/platform/app/src/routes/Settings/Settings.tsx +++ b/platform/app/src/routes/Settings/Settings.tsx @@ -19,6 +19,7 @@ import tenantRepository from '../../api/tenantRepository'; import { logoutUser } from '../../service/userService'; import { resetTutorialAndNotify } from '../../service/tutorialService'; import { FrontendVersionContext } from '../../App'; +import { getProfileCredentialDetails } from './profileCredentialDetails'; const SettingsPage = () => { const { t } = useTranslation('Settings'); @@ -214,6 +215,11 @@ const SettingsPage = () => { }; const GeneralSettings = () => { + const profileCredentials = getProfileCredentialDetails( + currentUser.specialty, + currentUser.licenseNo + ); + return (