自定义电子邮件验证页面 AWS Cognito

Customize email verification page AWS Cognito

我正在使用 Amazon Cognito 进行用户身份验证。用户注册后,验证电子邮件将发送到他的电子邮件地址。单击电子邮件 link 后,系统会在他的浏览器中提示他。

如何自定义此页面以插入将在移动应用程序中触发深层 links 的脚本,并使页面看起来更漂亮?

您可以使用 Cognito 触发器来做到这一点。

您可以配置触发器模板以定义带有 link 的消息到您控制的页面。 资产将存储在:amplify/backend/auth/<your-resource-name>CustomMessage/assets

documentation 有更多详细信息

Cognito allows you to configure your User Pool to send an email to your users when they attempt to register an account. You can configure this email to contain a link to Cognito’s Hosted UI where the user’s account will be marked as confirmed.

This trigger template allows you to define an email message with a link to a static S3 bucket that you control, where the user’s account will be confirmed and they can then be redirected to a URL of your choice (presumably your application). The URL will automatically contain the username as a query string parameters.

Please note that this trigger template will create an S3 resource. The files that populate the static site are available for edit in amplify/backend/auth/CustomMessage/assets. They consist of:

index.html
spinner.js (controls the spinner that appears on the page while users are awaiting confirmation)
style.css
verify.js (the script which performs the verification request)