Skip to content

Commit 3a06531

Browse files
committed
impr: better email changing logs
!nuf
1 parent bc999c2 commit 3a06531

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

backend/__tests__/api/controllers/user.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ describe("user controller test", () => {
10681068
);
10691069
expect(addImportantLogMock).toHaveBeenCalledWith(
10701070
"user_email_updated",
1071-
"changed email to [email protected]",
1071+
"changed email from [email protected] to [email protected]",
10721072
uid
10731073
);
10741074
});

backend/src/api/controllers/user.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,10 @@ export async function updateEmail(
405405
req: MonkeyRequest<undefined, UpdateEmailRequestSchema>
406406
): Promise<MonkeyResponse> {
407407
const { uid } = req.ctx.decodedToken;
408-
let { newEmail } = req.body;
408+
let { newEmail, previousEmail } = req.body;
409409

410410
newEmail = newEmail.toLowerCase();
411+
previousEmail = previousEmail.toLowerCase();
411412

412413
try {
413414
await AuthUtil.updateUserEmail(uid, newEmail);
@@ -440,7 +441,7 @@ export async function updateEmail(
440441

441442
void addImportantLog(
442443
"user_email_updated",
443-
`changed email to ${newEmail}`,
444+
`changed email from ${previousEmail} to ${newEmail}`,
444445
uid
445446
);
446447

0 commit comments

Comments
 (0)