From 578820eea8e299d8a5f3b5ed340e7c499ed0e84e Mon Sep 17 00:00:00 2001 From: anik Date: Tue, 14 Jan 2020 17:07:41 +0600 Subject: [PATCH 1/4] Stopped sending verification codes for pending and api users --- .../src/features/authenticate/handler.test.ts | 30 ++++++++++++++++++- .../auth/src/features/authenticate/handler.ts | 13 +++++--- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/packages/auth/src/features/authenticate/handler.test.ts b/packages/auth/src/features/authenticate/handler.test.ts index 36489e99369..fc665e6db65 100644 --- a/packages/auth/src/features/authenticate/handler.test.ts +++ b/packages/auth/src/features/authenticate/handler.test.ts @@ -68,7 +68,7 @@ describe('authenticate handler receives a request', () => { fetch.mockResponse( JSON.stringify({ userId: '1', - status: 'pending', + status: 'active', scope: ['admin'], mobile: `+345345343` }) @@ -88,5 +88,33 @@ describe('authenticate handler receives a request', () => { expect(spy.mock.calls[0]).toHaveLength(2) expect(spy.mock.calls[0][0]).toBe('+345345343') }) + it('does not generate a mobile verification code for pending users', async () => { + server = await createServerWithEnvironment({ NODE_ENV: 'production' }) + + const reloadedCodeService = require('../verifyCode/service') + + jest.spyOn(reloadedCodeService, 'generateNonce').mockReturnValue('12345') + + fetch.mockResponse( + JSON.stringify({ + userId: '1', + status: 'pending', + scope: ['admin'], + mobile: `+345345343` + }) + ) + const spy = jest.spyOn(reloadedCodeService, 'sendVerificationCode') + + await server.server.inject({ + method: 'POST', + url: '/authenticate', + payload: { + username: '+345345343', + password: '2r23432' + } + }) + + expect(spy).not.toHaveBeenCalled() + }) }) }) diff --git a/packages/auth/src/features/authenticate/handler.ts b/packages/auth/src/features/authenticate/handler.ts index 02df65f563c..543603ad3f0 100644 --- a/packages/auth/src/features/authenticate/handler.ts +++ b/packages/auth/src/features/authenticate/handler.ts @@ -51,10 +51,6 @@ export default async function authenticateHandler( } const nonce = generateNonce() - await storeUserInformation(nonce, result.userId, result.scope, result.mobile) - - await generateAndSendVerificationCode(nonce, result.mobile, result.scope) - const response: IAuthResponse = { mobile: result.mobile, status: result.status, @@ -74,6 +70,15 @@ export default async function authenticateHandler( : WEB_USER_JWT_AUDIENCES, JWT_ISSUER ) + } else { + await storeUserInformation( + nonce, + result.userId, + result.scope, + result.mobile + ) + + await generateAndSendVerificationCode(nonce, result.mobile, result.scope) } return response } From 443fcd323ad323848bf38a10b2b61d10db46b11b Mon Sep 17 00:00:00 2001 From: anik Date: Tue, 14 Jan 2020 17:16:08 +0600 Subject: [PATCH 2/4] Fixed certificate font issue when bn lang is selected --- .../src/bgd/features/templates/register.json | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/resources/src/bgd/features/templates/register.json b/packages/resources/src/bgd/features/templates/register.json index 72e3baf19be..046698e2550 100644 --- a/packages/resources/src/bgd/features/templates/register.json +++ b/packages/resources/src/bgd/features/templates/register.json @@ -2546,16 +2546,16 @@ ], "fonts": { "bn": { - "notosans": { - "normal": "NotoSansBengali-Light.ttf", - "regular": "NotoSansBengali-Light.ttf", - "bold": "NotoSansBengali-Regular.ttf" - }, "notosanscurrency": { "normal": "NotoSansBengali-Light.ttf", "regular": "NotoSansBengali-Light.ttf", "bold": "NotoSansBengali-Light.ttf" }, + "notosans": { + "normal": "NotoSans-Light.ttf", + "regular": "NotoSans-Light.ttf", + "bold": "NotoSans-Regular.ttf" + }, "notosanslocation": { "normal": "NotoSans-Light.ttf", "regular": "NotoSans-Light.ttf", @@ -3940,16 +3940,16 @@ ], "fonts": { "bn": { - "notosans": { - "normal": "NotoSansBengali-Light.ttf", - "regular": "NotoSansBengali-Light.ttf", - "bold": "NotoSansBengali-Regular.ttf" - }, "notosanscurrency": { "normal": "NotoSansBengali-Light.ttf", "regular": "NotoSansBengali-Light.ttf", "bold": "NotoSansBengali-Light.ttf" }, + "notosans": { + "normal": "NotoSans-Light.ttf", + "regular": "NotoSans-Light.ttf", + "bold": "NotoSans-Regular.ttf" + }, "notosanslocation": { "normal": "NotoSans-Light.ttf", "regular": "NotoSans-Light.ttf", From 703b2e456cd85e9b5a1b86ab1b57871950daec7d Mon Sep 17 00:00:00 2001 From: anik Date: Tue, 14 Jan 2020 17:43:26 +0600 Subject: [PATCH 3/4] Fixed brn/drn generation issue --- packages/resources/src/bgd/features/generate/service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/resources/src/bgd/features/generate/service.ts b/packages/resources/src/bgd/features/generate/service.ts index 284b3b862c2..359a55b237b 100644 --- a/packages/resources/src/bgd/features/generate/service.ts +++ b/packages/resources/src/bgd/features/generate/service.ts @@ -77,7 +77,7 @@ async function getLocationBBSCode(practionerId: string): Promise { }) } const bbsCode = jurisdictionalLocations.reduce( - (locBBSCode, loc) => locBBSCode.concat(loc.bbsCode || ''), + (locBBSCode, loc) => locBBSCode.concat(loc.bbsCode?.padStart(2, '0') || ''), '' ) From ee2b3132e62e1b75db05ec07b27fe3a043fb8b92 Mon Sep 17 00:00:00 2001 From: anik Date: Tue, 14 Jan 2020 17:49:54 +0600 Subject: [PATCH 4/4] Removed local country name for child's permanent addr from birth certificate --- packages/resources/src/bgd/features/templates/register.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/resources/src/bgd/features/templates/register.json b/packages/resources/src/bgd/features/templates/register.json index 046698e2550..fcb0a29e68f 100644 --- a/packages/resources/src/bgd/features/templates/register.json +++ b/packages/resources/src/bgd/features/templates/register.json @@ -1792,7 +1792,7 @@ "addressKey": "name", "addresses": { "countryCode": "mother.countryPermanent", - "localAddress": "{mother.addressLine4Permanent}, {mother.districtPermanent}, {mother.statePermanent}, {mother.countryPermanent}", + "localAddress": "{mother.addressLine4Permanent}, {mother.districtPermanent}, {mother.statePermanent}", "internationalAddress": "{mother.internationalDistrictPermanent}, {mother.internationalStatePermanent}, {mother.countryPermanent}" } }