forked from aws-amplify/amplify-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example for how to customize Sign Up (aws-amplify#552)
Co-authored-by: Eddie Keller <[email protected]>
- Loading branch information
1 parent
ad490a7
commit bba3242
Showing
43 changed files
with
1,414 additions
and
422 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,46 @@ | ||
--- | ||
'@aws-amplify/ui': patch | ||
'@aws-amplify/ui-react': patch | ||
--- | ||
|
||
`@aws-amplify/ui-react` supports validation & re-use & customization of `Authenticator.SignUp.FormFields` via `components` & `services`: | ||
|
||
```js | ||
<Authenticator | ||
components={{ | ||
SignUp: { | ||
FormFields() { | ||
const { validationErrors } = useAuthenticator(); | ||
return ( | ||
<> | ||
<TextField | ||
label="Preferred Username" | ||
labelHidden={true} | ||
name="preferred_username" | ||
placeholder="Preferred Username" | ||
/> | ||
<Authenticator.SignUp.FormFields /> | ||
<CheckboxField | ||
errorMessage={validationErrors.acknowledgement} | ||
hasError={!!validationErrors.acknowledgement} | ||
name="acknowledgement" | ||
value="yes" | ||
> | ||
I agree with the Terms & Conditions | ||
</CheckboxField> | ||
</> | ||
); | ||
}, | ||
}, | ||
}} | ||
services={{ | ||
async validateCustomSignUp(formData) { | ||
if (!formData.acknowledgement) { | ||
return { | ||
acknowledgement: 'You must agree to the Terms & Conditions', | ||
}; | ||
} | ||
}, | ||
}} | ||
/> | ||
``` |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
**/*.d.ts linguist-generated=true | ||
**/.graphqlconfig.yml linguist-generated=true | ||
**/amplify/** linguist-generated=true | ||
yarn.lock linguist-generated=true |
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
21 changes: 21 additions & 0 deletions
21
environments/auth-with-email-and-custom-attributes/.gitignore
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,21 @@ | ||
#amplify-do-not-edit-begin | ||
amplify/\#current-cloud-backend | ||
amplify/.config/local-* | ||
amplify/logs | ||
amplify/mock-data | ||
amplify/backend/amplify-meta.json | ||
amplify/backend/awscloudformation | ||
amplify/backend/.temp | ||
build/ | ||
dist/ | ||
node_modules/ | ||
aws-exports.js | ||
awsconfiguration.json | ||
amplifyconfiguration.json | ||
amplifyconfiguration.dart | ||
amplify-build-config.json | ||
amplify-gradle-config.json | ||
amplifytools.xcconfig | ||
.secret-* | ||
**.sample | ||
#amplify-do-not-edit-end |
22 changes: 22 additions & 0 deletions
22
environments/auth-with-email-and-custom-attributes/README.md
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,22 @@ | ||
# Auth with Email & Custom Attributes | ||
|
||
This backend is configured with Amplify Admin UI & cloned with Amplify CLI v6.3.1: | ||
|
||
- Authentication | ||
|
||
- `Email` login mechanism | ||
- Preferred Username (`preferred_username`) custom attribute | ||
|
||
## Using this Backend | ||
|
||
External contributors can re-create this backend by running: | ||
|
||
```shell | ||
amplify pull | ||
``` | ||
|
||
Internal (Amplify UI team) contributors can use this backend directly by running: | ||
|
||
```shell | ||
amplify pull --appId di3yvcoio2o2w --envName staging --yes | ||
``` |
17 changes: 17 additions & 0 deletions
17
environments/auth-with-email-and-custom-attributes/amplify/.config/project-config.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.