From 15be2fa5c1012e2b2f08cf6cad5b47de5fff71f4 Mon Sep 17 00:00:00 2001 From: josefaidt Date: Fri, 11 Oct 2024 10:15:30 -0700 Subject: [PATCH] update password policy override --- .../manage-users/manage-passwords/index.mdx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-passwords/index.mdx b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-passwords/index.mdx index a1b96ee8b95..158c44b4c97 100644 --- a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-passwords/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-passwords/index.mdx @@ -521,18 +521,23 @@ You can customize the password format acceptable by your auth backend. By defaul - `tempPasswordValidity`: 3 days ```ts title="amplify/backend.ts" -// amplify/backend.ts import { defineBackend } from '@aws-amplify/backend'; import { auth } from './auth/resource'; -import { data } from './data/resource'; const backend = defineBackend({ auth, - data }); - -// extract L1 UserPool construct +// extract L1 CfnUserPool resources const { cfnUserPool } = backend.auth.resources.cfnResources; -// from the CDK use `addPropertyOverride` to modify properties directly -cfnUserPool.addPropertyOverride('Policies.PasswordPolicy.MinimumLength', 32); +// modify cfnUserPool policies directly +cfnUserPool.policies = { + passwordPolicy: { + minimumLength: 32, + requireLowercase: true, + requireNumbers: true, + requireSymbols: true, + requireUppercase: true, + temporaryPasswordValidityDays: 20, + }, +}; ```