bebu
1
Hi to all,
I create my auth stack like this:
const auth = new Auth(stack, "Auth", {
login: ["email"],
});
This sets the cognito password policy to “Cognito defaults” (8 characters minimum length, at least 1 number, 1 special character, …)
Is there a way to customize the password policy?
Yes, apparently it is different for v2 and v3. For v3:
export const userPool = new sst.aws.CognitoUserPool(
"UserPool",
{
usernames: ["email"],
verify: {
emailSubject: "Verify your email for our app",
emailMessage: "Hello {username}, your verification code is {####}",
},
transform: {
userPool: (args, _opts) => {
args.passwordPolicy = {
minimumLength: 10,
requireUppercase: false,
requireSymbols: false,
requireNumbers: false,
requireLowercase: false,
temporaryPasswordValidityDays: 7,
}
}
}
}