且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Angular AWS Amplify身份验证器外部字段

更新时间:2023-12-02 21:17:28

在撰写此评论时,Angular或React的完整版本(仅Vue)可能没有出现,但是试用版确实有一些选择。

It doesn't appear at the time of the writing of this comment that it's possible with the full release for Angular or React (only Vue), but the beta release does have some options.

您可以通过添加以下软件包来获得测试版:

You can get the beta by adding the following package:

npm install aws-amplify-angular@beta

并更新放大-authenticator组件看起来像这样:

And updating the amplify-authenticator component to look like this:

<amplify-authenticator [signUpConfig]="signUpConfig" ></amplify-authenticator>

在您的组件中设置signupConfig的位置,看起来像这样:

Where signupConfig will be set in your component and will look something like this:

const signUpConfig = {
  header: 'Welcome!',
  defaultCountryCode: '46',
  hideDefaults: true,
  signUpFields: [
    {
      label: 'Username',
      key: 'username',
      required: true,
      displayOrder: 1,
      type: 'string',
    },
    {
      label: 'Password',
      key: 'password',
      required: true,
      displayOrder: 2,
      type: 'password',
    },
    {
      label: 'Email',
      key: 'email',
      required: true,
      displayOrder: 3,
      type: 'email',
    },
    {
      label: 'Name',
      key: 'name',
      required: true,
      displayOrder: 4,
      type: 'string',
    },
    {
      label: 'Family name',
      key: 'family_name',
      required: true,
      displayOrder: 5,
      type: 'string',
    },
    {
      label: 'Phone number',
      key: 'phone_number',
      required: false,
      displayOrder: 6,
      type: 'string',
    }
  ]
};

有关详细信息,请参见以下两个链接:

See the following two links for details:

https://github.com/aws-amplify/ amplify-js / issues / 1911#issuecomment-437090097
https://haverchuck.github.io/docs/js/ionic#signup-configuration