-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support configuring SES for email sender (#1851)
* feat: exposed parameters to be able to configure Cognito to send emails with SES * feat: updated auth construct to feed new properties to UserPool settings * empty string in fromEmail field if no email provided * altered comment describing email configuation * chore: added changeset * chore: check if senders is undefined * chore: updated API * chore: added test for email configuration * chore: updated variable name for expected value of fromEmail and fromName * Revert "chore: updated variable name for expected value of fromEmail and fromName" This reverts commit 794ba4b. * chore: changed variable name, merged main into branch * chore: updated docs for configuring SES email sender --------- Co-authored-by: Vieltojarvi <[email protected]>
- Loading branch information
1 parent
d755f74
commit 61d4fb3
Showing
5 changed files
with
58 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@aws-amplify/auth-construct': minor | ||
--- | ||
|
||
add support for configuring SES for email sender |
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
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 |
---|---|---|
|
@@ -545,6 +545,34 @@ void describe('Auth construct', () => { | |
); | ||
}); | ||
|
||
void it('configures Cognito to send emails with SES when senders field is populated', () => { | ||
const app = new App(); | ||
const stack = new Stack(app); | ||
const expectedNameAndEmail = 'Example.com <[email protected]>'; | ||
const expectedReply = '[email protected]'; | ||
const sesEmailSettings = { | ||
fromEmail: '[email protected]', | ||
fromName: 'Example.com', | ||
replyTo: '[email protected]', | ||
}; | ||
new AmplifyAuth(stack, 'test', { | ||
loginWith: { | ||
email: true, | ||
}, | ||
senders: { | ||
email: sesEmailSettings, | ||
}, | ||
}); | ||
|
||
const template = Template.fromStack(stack); | ||
template.allResourcesProperties('AWS::Cognito::UserPool', { | ||
EmailConfiguration: { | ||
From: expectedNameAndEmail, | ||
ReplyToEmailAddress: expectedReply, | ||
}, | ||
}); | ||
}); | ||
|
||
void it('requires email attribute if email is enabled', () => { | ||
const app = new App(); | ||
const stack = new Stack(app); | ||
|
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
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