Skip to content

Instantly share code, notes, and snippets.

@wlee221
Last active April 27, 2021 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wlee221/9e3c6347aa5883d2a82c54714b68248e to your computer and use it in GitHub Desktop.
Save wlee221/9e3c6347aa5883d2a82c54714b68248e to your computer and use it in GitHub Desktop.
Authenticator test templates for each usernameAlias
<AmplifyAuthContainer>
<AmplifyAuthenticator usernameAlias="email">
<AmplifySignIn
slot="sign-in"
headerText="My Custom Sign In"
usernameAlias="email"
formFields={[
{
type: 'email',
label: 'Custom Email Label',
placeholder: 'custom email placeholder',
inputProps: { required: true, autocomplete: 'username' },
},
{
type: 'password',
label: 'Custom Password Label',
placeholder: 'custom password placeholder',
inputProps: { required: true, autocomplete: 'current-password' },
},
]}
>
<div slot="header-subtitle">Subtitle with nested slot</div>
</AmplifySignIn>
<AmplifySignUp
slot="sign-up"
headerText="My Custom Sign Up"
usernameAlias="email" // this shouldn't be necessary...
formFields={[
{
type: 'email',
label: 'Custom Email Label',
placeholder: 'custom email placeholder',
inputProps: { required: true, autocomplete: 'username' },
},
{
type: 'password',
label: 'Custom Password Label',
placeholder: 'Custom password placeholder',
inputProps: { required: true, autocomplete: 'new-password' },
},
{
type: 'phone_number',
label: 'Custom Phone Label',
placeholder: 'custom Phone placeholder',
inputProps: { required: true },
},
]}
>
<div slot="header-subtitle">Subtitle with nested slot</div>
</AmplifySignUp>
<AmplifyConfirmSignUp
headerText="My Custom Confirm Sign Up"
slot="confirm-sign-up"
user={user}
usernameAlias="email"
formFields={[
{
type: 'email',
label: 'Custom Email Label',
placeholder: 'custom email placeholder',
inputProps: { required: true },
value: user?.username,
disabled: user?.username,
},
{
type: 'code',
label: 'Custom Confirmation code',
placeholder: 'Custom Confirmation Code',
inputProps: { required: true },
},
]}
>
<div slot="header-subtitle">Subtitle with nested slot</div>
</AmplifyConfirmSignUp>
</AmplifyAuthenticator>
</AmplifyAuthContainer>
<AmplifyAuthContainer>
<AmplifyAuthenticator usernameAlias="phone_number">
<AmplifySignIn
slot="sign-in"
headerText="My Custom Sign In"
usernameAlias="phone_number"
formFields={[
{
type: 'phone_number',
label: 'Custom Phone Label',
placeholder: 'Custom Phone Number Placeholder',
inputProps: { required: true, autocomplete: 'username' },
},
{
type: 'password',
label: 'Custom Password Label',
placeholder: 'custom password placeholder',
inputProps: { required: true, autocomplete: 'current-password' },
},
]}
>
<div slot="header-subtitle">Subtitle with nested slot</div>
</AmplifySignIn>
<AmplifySignUp
slot="sign-up"
headerText="My Custom Sign Up"
usernameAlias="phone_number" // this shouldn't be necessary...
formFields={[
{
type: 'phone_number',
label: 'Custom Phone Label',
placeholder: 'Custom Phone Number Placeholder',
inputProps: { required: true, autocomplete: 'username' },
},
{
type: 'password',
label: 'Custom Password Label',
placeholder: 'Custom password placeholder',
inputProps: { required: true, autocomplete: 'new-password' },
},
{
type: 'email',
label: 'Custom Email Label',
placeholder: 'Custom Email Number Placeholder',
inputProps: { required: true, autocomplete: 'email' },
},
]}
>
<div slot="header-subtitle">Subtitle with nested slot</div>
</AmplifySignUp>
<AmplifyConfirmSignUp
headerText="My Custom Confirm Sign Up"
slot="confirm-sign-up"
user={user}
usernameAlias="phone_number"
formFields={[
{
type: 'phone_number',
label: 'Custom Phone Label',
placeholder: 'Custom Phone Number Placeholder',
inputProps: { required: true },
value: user?.username,
disabled: user?.username,
},
{
type: 'code',
label: 'Custom Confirmation code',
placeholder: 'Custom Confirmation Code',
inputProps: { required: true },
},
]}
>
<div slot="header-subtitle">Subtitle with nested slot</div>
</AmplifyConfirmSignUp>
</AmplifyAuthenticator>
</AmplifyAuthContainer>
<AmplifyAuthContainer>
<AmplifyAuthenticator>
<AmplifySignIn
slot="sign-in"
headerText="My Custom Sign In"
formFields={[
{
type: 'username',
label: 'Custom Username',
placeholder: 'Custom Username Placeholder',
inputProps: { required: true, autocomplete: 'username' },
},
{
type: 'password',
label: 'Custom Password Label',
placeholder: 'custom password placeholder',
inputProps: { required: true, autocomplete: 'current-password' },
},
]}
>
<div slot="header-subtitle">Subtitle with nested slot</div>
</AmplifySignIn>
<AmplifySignUp
slot="sign-up"
headerText="My Custom Sign Up"
formFields={[
{
type: 'username',
label: 'Custom Username',
placeholder: 'Custom Username Placeholder',
inputProps: { required: true, autocomplete: 'username' },
},
{
type: 'password',
label: 'Custom Password Label',
placeholder: 'Custom password placeholder',
inputProps: { required: true, autocomplete: 'new-password' },
},
{
type: 'email',
label: 'Custom Email Label',
placeholder: 'Custom Email Number Placeholder',
inputProps: { required: true, autocomplete: 'email' },
},
]}
>
<div slot="header-subtitle">Subtitle with nested slot</div>
</AmplifySignUp>
<AmplifyConfirmSignUp
headerText="My Custom Confirm Sign Up"
slot="confirm-sign-up"
user={user}
formFields={[
{
type: 'username',
label: 'Custom Username',
placeholder: 'Custom Username Placeholder',
inputProps: { required: true, autocomplete: 'username' },
value: user?.username,
disabled: user?.username,
},
{
type: 'code',
label: 'Custom Confirmation code',
placeholder: 'Custom Confirmation Code',
inputProps: { required: true },
},
]}
>
<div slot="header-subtitle">Subtitle with nested slot</div>
</AmplifyConfirmSignUp>
</AmplifyAuthenticator>
</AmplifyAuthContainer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment