mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-08 13:11:19 +08:00
impr: better email changing logs
!nuf
This commit is contained in:
parent
bc999c2ab3
commit
3a065313bf
2 changed files with 4 additions and 3 deletions
|
|
@ -1068,7 +1068,7 @@ describe("user controller test", () => {
|
|||
);
|
||||
expect(addImportantLogMock).toHaveBeenCalledWith(
|
||||
"user_email_updated",
|
||||
"changed email to newemail@example.com",
|
||||
"changed email from previousemail@example.com to newemail@example.com",
|
||||
uid
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -405,9 +405,10 @@ export async function updateEmail(
|
|||
req: MonkeyRequest<undefined, UpdateEmailRequestSchema>
|
||||
): Promise<MonkeyResponse> {
|
||||
const { uid } = req.ctx.decodedToken;
|
||||
let { newEmail } = req.body;
|
||||
let { newEmail, previousEmail } = req.body;
|
||||
|
||||
newEmail = newEmail.toLowerCase();
|
||||
previousEmail = previousEmail.toLowerCase();
|
||||
|
||||
try {
|
||||
await AuthUtil.updateUserEmail(uid, newEmail);
|
||||
|
|
@ -440,7 +441,7 @@ export async function updateEmail(
|
|||
|
||||
void addImportantLog(
|
||||
"user_email_updated",
|
||||
`changed email to ${newEmail}`,
|
||||
`changed email from ${previousEmail} to ${newEmail}`,
|
||||
uid
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue