-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: reuse isDefaultFromAddress
- Loading branch information
1 parent
d7b4229
commit 69cf50c
Showing
1 changed file
with
1 addition
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,17 +223,10 @@ export const InitEmailMiddleware = ( | |
const { fromName: defaultFromName, fromAddress: defaultFromAddress } = | ||
parseFromAddress(config.get('mailFrom')) | ||
|
||
// As part of a PSD directive, we have changed the defaultFromAddress to [email protected]. | ||
// To prevent any breaking changes, we must now support both the new and old default address | ||
const allowedDefaultAddresses = [ | ||
defaultFromAddress, | ||
'[email protected]', | ||
] | ||
|
||
if ( | ||
// user enters an email that is neither their own nor info@mail.postman.gov.sg | ||
fromAddress !== userEmail && | ||
!allowedDefaultAddresses.includes(fromAddress) | ||
!isDefaultFromAddress(from) | ||
) { | ||
logger.error({ | ||
message: INVALID_FROM_ADDRESS_ERROR_MESSAGE, | ||
|