@webiny/cognito 0.0.0-unstable.3c5210ad37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cognito.d.ts +8 -0
- package/Cognito.js +29 -0
- package/Cognito.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/admin/Cognito.d.ts +6 -0
- package/admin/Cognito.js +51 -0
- package/admin/Cognito.js.map +1 -0
- package/admin/CognitoLogin.d.ts +7 -0
- package/admin/CognitoLogin.js +18 -0
- package/admin/CognitoLogin.js.map +1 -0
- package/admin/Extension.d.ts +2 -0
- package/admin/Extension.js +20 -0
- package/admin/Extension.js.map +1 -0
- package/admin/SecurityPermission.d.ts +2 -0
- package/admin/SecurityPermission.js +26 -0
- package/admin/SecurityPermission.js.map +1 -0
- package/admin/federatedIdentityProviders.d.ts +9 -0
- package/admin/federatedIdentityProviders.js +9 -0
- package/admin/federatedIdentityProviders.js.map +1 -0
- package/admin/plugins/constants.d.ts +3 -0
- package/admin/plugins/constants.js +6 -0
- package/admin/plugins/constants.js.map +1 -0
- package/admin/plugins/userMenu/AccountDetails.d.ts +6 -0
- package/admin/plugins/userMenu/AccountDetails.js +23 -0
- package/admin/plugins/userMenu/AccountDetails.js.map +1 -0
- package/admin/plugins/userMenu/useIsDefaultTenant.d.ts +1 -0
- package/admin/plugins/userMenu/useIsDefaultTenant.js +15 -0
- package/admin/plugins/userMenu/useIsDefaultTenant.js.map +1 -0
- package/admin/presentation/Cognito/CognitoLoginScreen.d.ts +10 -0
- package/admin/presentation/Cognito/CognitoLoginScreen.js +54 -0
- package/admin/presentation/Cognito/CognitoLoginScreen.js.map +1 -0
- package/admin/presentation/Cognito/CognitoPresenter.d.ts +58 -0
- package/admin/presentation/Cognito/CognitoPresenter.js +277 -0
- package/admin/presentation/Cognito/CognitoPresenter.js.map +1 -0
- package/admin/presentation/Cognito/abstractions.d.ts +72 -0
- package/admin/presentation/Cognito/abstractions.js +4 -0
- package/admin/presentation/Cognito/abstractions.js.map +1 -0
- package/admin/presentation/Cognito/components/Divider.d.ts +2 -0
- package/admin/presentation/Cognito/components/Divider.js +16 -0
- package/admin/presentation/Cognito/components/Divider.js.map +1 -0
- package/admin/presentation/Cognito/components/FederatedLogin.d.ts +7 -0
- package/admin/presentation/Cognito/components/FederatedLogin.js +32 -0
- package/admin/presentation/Cognito/components/FederatedLogin.js.map +1 -0
- package/admin/presentation/Cognito/components/FederatedProviders.d.ts +44 -0
- package/admin/presentation/Cognito/components/FederatedProviders.js +14 -0
- package/admin/presentation/Cognito/components/FederatedProviders.js.map +1 -0
- package/admin/presentation/Cognito/components/FooterSignIn.d.ts +6 -0
- package/admin/presentation/Cognito/components/FooterSignIn.js +15 -0
- package/admin/presentation/Cognito/components/FooterSignIn.js.map +1 -0
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.d.ts +9 -0
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js +43 -0
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js.map +1 -0
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.d.ts +8 -0
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js +45 -0
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js.map +1 -0
- package/admin/presentation/Cognito/components/RequireNewPassword.d.ts +8 -0
- package/admin/presentation/Cognito/components/RequireNewPassword.js +55 -0
- package/admin/presentation/Cognito/components/RequireNewPassword.js.map +1 -0
- package/admin/presentation/Cognito/components/SetNewPassword.d.ts +8 -0
- package/admin/presentation/Cognito/components/SetNewPassword.js +79 -0
- package/admin/presentation/Cognito/components/SetNewPassword.js.map +1 -0
- package/admin/presentation/Cognito/components/SignIn.d.ts +10 -0
- package/admin/presentation/Cognito/components/SignIn.js +64 -0
- package/admin/presentation/Cognito/components/SignIn.js.map +1 -0
- package/admin/presentation/Cognito/components/View.d.ts +98 -0
- package/admin/presentation/Cognito/components/View.js +67 -0
- package/admin/presentation/Cognito/components/View.js.map +1 -0
- package/admin/presentation/Cognito/feature.d.ts +3 -0
- package/admin/presentation/Cognito/feature.js +16 -0
- package/admin/presentation/Cognito/feature.js.map +1 -0
- package/admin/presentation/shared/createPasswordValidator.d.ts +8 -0
- package/admin/presentation/shared/createPasswordValidator.js +27 -0
- package/admin/presentation/shared/createPasswordValidator.js.map +1 -0
- package/admin/presentation/shared/usePasswordValidator.d.ts +1 -0
- package/admin/presentation/shared/usePasswordValidator.js +15 -0
- package/admin/presentation/shared/usePasswordValidator.js.map +1 -0
- package/admin/routes.d.ts +10 -0
- package/admin/routes.js +21 -0
- package/admin/routes.js.map +1 -0
- package/admin/ui/UserItem.d.ts +10 -0
- package/admin/ui/UserItem.js +3 -0
- package/admin/ui/UserItem.js.map +1 -0
- package/admin/ui/components/AvatarImage/AvatarImage.d.ts +3 -0
- package/admin/ui/components/AvatarImage/AvatarImage.js +43 -0
- package/admin/ui/components/AvatarImage/AvatarImage.js.map +1 -0
- package/admin/ui/components/AvatarImage/AvatarImagePreview.d.ts +10 -0
- package/admin/ui/components/AvatarImage/AvatarImagePreview.js +55 -0
- package/admin/ui/components/AvatarImage/AvatarImagePreview.js.map +1 -0
- package/admin/ui/components/AvatarImage/AvatarImageTrigger.d.ts +7 -0
- package/admin/ui/components/AvatarImage/AvatarImageTrigger.js +29 -0
- package/admin/ui/components/AvatarImage/AvatarImageTrigger.js.map +1 -0
- package/admin/ui/components/AvatarImage/index.d.ts +1 -0
- package/admin/ui/components/AvatarImage/index.js +3 -0
- package/admin/ui/components/AvatarImage/index.js.map +1 -0
- package/admin/ui/views/Account/Account.d.ts +2 -0
- package/admin/ui/views/Account/Account.js +142 -0
- package/admin/ui/views/Account/Account.js.map +1 -0
- package/admin/ui/views/Account/graphql.d.ts +2 -0
- package/admin/ui/views/Account/graphql.js +40 -0
- package/admin/ui/views/Account/graphql.js.map +1 -0
- package/admin/ui/views/Account/index.d.ts +1 -0
- package/admin/ui/views/Account/index.js +3 -0
- package/admin/ui/views/Account/index.js.map +1 -0
- package/admin/ui/views/Users/UsersDataList.d.ts +3 -0
- package/admin/ui/views/Users/UsersDataList.js +172 -0
- package/admin/ui/views/Users/UsersDataList.js.map +1 -0
- package/admin/ui/views/Users/UsersForm.d.ts +5 -0
- package/admin/ui/views/Users/UsersForm.js +174 -0
- package/admin/ui/views/Users/UsersForm.js.map +1 -0
- package/admin/ui/views/Users/UsersView.d.ts +2 -0
- package/admin/ui/views/Users/UsersView.js +14 -0
- package/admin/ui/views/Users/UsersView.js.map +1 -0
- package/admin/ui/views/Users/components/DeleteAction.d.ts +7 -0
- package/admin/ui/views/Users/components/DeleteAction.js +36 -0
- package/admin/ui/views/Users/components/DeleteAction.js.map +1 -0
- package/admin/ui/views/Users/graphql.d.ts +5 -0
- package/admin/ui/views/Users/graphql.js +99 -0
- package/admin/ui/views/Users/graphql.js.map +1 -0
- package/admin/ui/views/Users/hooks/useUserForm.d.ts +27 -0
- package/admin/ui/views/Users/hooks/useUserForm.js +127 -0
- package/admin/ui/views/Users/hooks/useUserForm.js.map +1 -0
- package/admin/ui/views/Users/search.svg +20 -0
- package/admin/ui/views/utils.d.ts +3 -0
- package/admin/ui/views/utils.js +10 -0
- package/admin/ui/views/utils.js.map +1 -0
- package/api/CognitoApiFeature.d.ts +1 -0
- package/api/CognitoApiFeature.js +28 -0
- package/api/CognitoApiFeature.js.map +1 -0
- package/api/domain/Username.d.ts +4 -0
- package/api/domain/Username.js +7 -0
- package/api/domain/Username.js.map +1 -0
- package/api/domain/errors.d.ts +37 -0
- package/api/domain/errors.js +63 -0
- package/api/domain/errors.js.map +1 -0
- package/api/features/CognitoIdp/CognitoIdentityProvider.d.ts +15 -0
- package/api/features/CognitoIdp/CognitoIdentityProvider.js +61 -0
- package/api/features/CognitoIdp/CognitoIdentityProvider.js.map +1 -0
- package/api/features/CognitoIdp/abstractions.d.ts +15 -0
- package/api/features/CognitoIdp/abstractions.js +4 -0
- package/api/features/CognitoIdp/abstractions.js.map +1 -0
- package/api/features/CognitoIdp/feature.d.ts +1 -0
- package/api/features/CognitoIdp/feature.js +10 -0
- package/api/features/CognitoIdp/feature.js.map +1 -0
- package/api/features/CognitoIdp/index.d.ts +2 -0
- package/api/features/CognitoIdp/index.js +4 -0
- package/api/features/CognitoIdp/index.js.map +1 -0
- package/api/features/CognitoService/CognitoService.d.ts +20 -0
- package/api/features/CognitoService/CognitoService.js +90 -0
- package/api/features/CognitoService/CognitoService.js.map +1 -0
- package/api/features/CognitoService/abstractions.d.ts +54 -0
- package/api/features/CognitoService/abstractions.js +8 -0
- package/api/features/CognitoService/abstractions.js.map +1 -0
- package/api/features/CognitoService/feature.d.ts +5 -0
- package/api/features/CognitoService/feature.js +12 -0
- package/api/features/CognitoService/feature.js.map +1 -0
- package/api/features/CognitoService/index.d.ts +1 -0
- package/api/features/CognitoService/index.js +3 -0
- package/api/features/CognitoService/index.js.map +1 -0
- package/api/features/CreateUser/CreateUserUseCase.d.ts +22 -0
- package/api/features/CreateUser/CreateUserUseCase.js +106 -0
- package/api/features/CreateUser/CreateUserUseCase.js.map +1 -0
- package/api/features/CreateUser/abstractions.d.ts +35 -0
- package/api/features/CreateUser/abstractions.js +4 -0
- package/api/features/CreateUser/abstractions.js.map +1 -0
- package/api/features/CreateUser/feature.d.ts +1 -0
- package/api/features/CreateUser/feature.js +10 -0
- package/api/features/CreateUser/feature.js.map +1 -0
- package/api/features/CreateUser/index.d.ts +2 -0
- package/api/features/CreateUser/index.js +4 -0
- package/api/features/CreateUser/index.js.map +1 -0
- package/api/features/CreateUser/schema.d.ts +47 -0
- package/api/features/CreateUser/schema.js +17 -0
- package/api/features/CreateUser/schema.js.map +1 -0
- package/api/features/DeleteUser/DeleteUserUseCase.d.ts +16 -0
- package/api/features/DeleteUser/DeleteUserUseCase.js +54 -0
- package/api/features/DeleteUser/DeleteUserUseCase.js.map +1 -0
- package/api/features/DeleteUser/abstractions.d.ts +19 -0
- package/api/features/DeleteUser/abstractions.js +4 -0
- package/api/features/DeleteUser/abstractions.js.map +1 -0
- package/api/features/DeleteUser/feature.d.ts +1 -0
- package/api/features/DeleteUser/feature.js +10 -0
- package/api/features/DeleteUser/feature.js.map +1 -0
- package/api/features/DeleteUser/index.d.ts +2 -0
- package/api/features/DeleteUser/index.js +4 -0
- package/api/features/DeleteUser/index.js.map +1 -0
- package/api/features/UpdateUser/UpdateUserUseCase.d.ts +21 -0
- package/api/features/UpdateUser/UpdateUserUseCase.js +88 -0
- package/api/features/UpdateUser/UpdateUserUseCase.js.map +1 -0
- package/api/features/UpdateUser/abstractions.d.ts +33 -0
- package/api/features/UpdateUser/abstractions.js +4 -0
- package/api/features/UpdateUser/abstractions.js.map +1 -0
- package/api/features/UpdateUser/feature.d.ts +1 -0
- package/api/features/UpdateUser/feature.js +10 -0
- package/api/features/UpdateUser/feature.js.map +1 -0
- package/api/features/UpdateUser/index.d.ts +2 -0
- package/api/features/UpdateUser/index.js +4 -0
- package/api/features/UpdateUser/index.js.map +1 -0
- package/api/features/UpdateUser/schema.d.ts +44 -0
- package/api/features/UpdateUser/schema.js +16 -0
- package/api/features/UpdateUser/schema.js.map +1 -0
- package/api/features/UserInstaller/UserInstaller.d.ts +27 -0
- package/api/features/UserInstaller/UserInstaller.js +48 -0
- package/api/features/UserInstaller/UserInstaller.js.map +1 -0
- package/api/features/UserInstaller/feature.d.ts +1 -0
- package/api/features/UserInstaller/feature.js +10 -0
- package/api/features/UserInstaller/feature.js.map +1 -0
- package/api/graphql/user.gql.d.ts +8 -0
- package/api/graphql/user.gql.js +167 -0
- package/api/graphql/user.gql.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.js +4 -0
- package/index.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, Grid, Input, Alert } from "@webiny/admin-ui";
|
|
3
|
+
import { Form, Bind } from "@webiny/form";
|
|
4
|
+
import { validation } from "@webiny/validation";
|
|
5
|
+
import { View } from "./View.js";
|
|
6
|
+
import { FooterSignIn } from "./FooterSignIn.js";
|
|
7
|
+
export const RequestPasswordResetCode = props => {
|
|
8
|
+
const {
|
|
9
|
+
vm,
|
|
10
|
+
...actions
|
|
11
|
+
} = props;
|
|
12
|
+
return /*#__PURE__*/React.createElement(View.Container, null, /*#__PURE__*/React.createElement(Form, {
|
|
13
|
+
onSubmit: data => actions.onRequestCode(data.username),
|
|
14
|
+
submitOnEnter: true
|
|
15
|
+
}, ({
|
|
16
|
+
submit
|
|
17
|
+
}) => /*#__PURE__*/React.createElement(View.Content, null, /*#__PURE__*/React.createElement(View.Title, {
|
|
18
|
+
title: "Password recovery",
|
|
19
|
+
description: "Request a password reset code."
|
|
20
|
+
}), vm.message && /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "mb-lg"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Alert, {
|
|
23
|
+
title: vm.message.title,
|
|
24
|
+
type: vm.message.type
|
|
25
|
+
}, vm.message.text)), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
26
|
+
span: 12
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
28
|
+
name: "username",
|
|
29
|
+
validators: validation.create("required,email")
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
31
|
+
label: "Email"
|
|
32
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
33
|
+
span: 12
|
|
34
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: "flex flex-row-reverse items-center justify-between"
|
|
36
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
37
|
+
text: "Send me the code",
|
|
38
|
+
onClick: submit,
|
|
39
|
+
disabled: vm.isLoading
|
|
40
|
+
}), /*#__PURE__*/React.createElement(FooterSignIn, {
|
|
41
|
+
onSignIn: actions.onCancel
|
|
42
|
+
})))))));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=RequestPasswordResetCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Button","Grid","Input","Alert","Form","Bind","validation","View","FooterSignIn","RequestPasswordResetCode","props","vm","actions","createElement","Container","onSubmit","data","onRequestCode","username","submitOnEnter","submit","Content","Title","title","description","message","className","type","text","Column","span","name","validators","create","label","onClick","disabled","isLoading","onSignIn","onCancel"],"sources":["RequestPasswordResetCode.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Input, Alert } from \"@webiny/admin-ui\";\nimport { Form, Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { RequestPasswordResetCodeVM } from \"~/admin/presentation/Cognito/abstractions.js\";\nimport { FooterSignIn } from \"~/admin/presentation/Cognito/components/FooterSignIn.js\";\n\nexport interface ForgotPasswordProps {\n vm: RequestPasswordResetCodeVM;\n onRequestCode: (username: string) => void;\n onCancel: () => void;\n}\n\nexport const RequestPasswordResetCode = (props: ForgotPasswordProps) => {\n const { vm, ...actions } = props;\n\n return (\n <View.Container>\n <Form onSubmit={(data: any) => actions.onRequestCode(data.username)} submitOnEnter>\n {({ submit }) => (\n <View.Content>\n <View.Title\n title={\"Password recovery\"}\n description={\"Request a password reset code.\"}\n />\n\n {vm.message && (\n <div className={\"mb-lg\"}>\n <Alert title={vm.message.title} type={vm.message.type}>\n {vm.message.text}\n </Alert>\n </div>\n )}\n\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name=\"username\"\n validators={validation.create(\"required,email\")}\n >\n <Input label={\"Email\"} />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div\n className={\"flex flex-row-reverse items-center justify-between\"}\n >\n <Button\n text={\"Send me the code\"}\n onClick={submit}\n disabled={vm.isLoading}\n />\n <FooterSignIn onSignIn={actions.onCancel} />\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,M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AAA,CAACX,KAAK;IAACgC,KAAK,EAAE;EAAQ,CAAE,CACtB,CACG,CAAC,eACdnC,KAAA,CAAAc,aAAA,CAACZ,IAAI,CAAC4B,MAAM;IAACC,IAAI,EAAE;EAAG,gBAClB/B,KAAA,CAAAc,aAAA;IACIa,SAAS,EAAE;EAAqD,gBAEhE3B,KAAA,CAAAc,aAAA,CAACb,MAAM;IACH4B,IAAI,EAAE,kBAAmB;IACzBO,OAAO,EAAEf,MAAO;IAChBgB,QAAQ,EAAEzB,EAAE,CAAC0B;EAAU,CAC1B,CAAC,eACFtC,KAAA,CAAAc,aAAA,CAACL,YAAY;IAAC8B,QAAQ,EAAE1B,OAAO,CAAC2B;EAAS,CAAE,CAC1C,CACI,CACX,CACI,CAEhB,CACM,CAAC;AAEzB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { RequireNewPasswordVM } from "../../../../admin/presentation/Cognito/abstractions.js";
|
|
3
|
+
export interface RequireNewPasswordProps {
|
|
4
|
+
vm: RequireNewPasswordVM;
|
|
5
|
+
onSubmit: (password: string, attributes: any) => void;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const RequireNewPassword: (props: RequireNewPasswordProps) => React.JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, Grid, Heading, Input } from "@webiny/admin-ui";
|
|
3
|
+
import { Form, Bind } from "@webiny/form";
|
|
4
|
+
import { validation } from "@webiny/validation";
|
|
5
|
+
import { View } from "./View.js";
|
|
6
|
+
const sentenceCase = str => {
|
|
7
|
+
const lower = str.toLowerCase();
|
|
8
|
+
return lower[0].toUpperCase() + lower.substring(1);
|
|
9
|
+
};
|
|
10
|
+
export const RequireNewPassword = props => {
|
|
11
|
+
const {
|
|
12
|
+
vm,
|
|
13
|
+
onSubmit
|
|
14
|
+
} = props;
|
|
15
|
+
return /*#__PURE__*/React.createElement(View.Container, null, /*#__PURE__*/React.createElement(Form, {
|
|
16
|
+
onSubmit: data => onSubmit(data.password, data.requiredAttributes),
|
|
17
|
+
submitOnEnter: true
|
|
18
|
+
}, ({
|
|
19
|
+
submit
|
|
20
|
+
}) => /*#__PURE__*/React.createElement(View.Content, null, /*#__PURE__*/React.createElement(View.Title, {
|
|
21
|
+
title: "Set new password"
|
|
22
|
+
}), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
23
|
+
span: 12
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
25
|
+
name: "password",
|
|
26
|
+
validators: validation.create("required")
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
28
|
+
type: "password",
|
|
29
|
+
label: "New password",
|
|
30
|
+
autoComplete: "off"
|
|
31
|
+
}))), vm.requiredAttributes.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
32
|
+
span: 12
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
34
|
+
level: 6,
|
|
35
|
+
className: "text-center"
|
|
36
|
+
}, "Please enter additional information")), vm.requiredAttributes.map(attr => /*#__PURE__*/React.createElement(Grid.Column, {
|
|
37
|
+
key: attr,
|
|
38
|
+
span: 12
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
40
|
+
name: `requiredAttributes.${attr}`
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
42
|
+
label: sentenceCase(attr)
|
|
43
|
+
}))))) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
44
|
+
span: 12
|
|
45
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: "flex flex-row-reverse items-center justify-between"
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
48
|
+
text: "Confirm",
|
|
49
|
+
onClick: submit,
|
|
50
|
+
size: "lg",
|
|
51
|
+
disabled: vm.isLoading
|
|
52
|
+
})))))));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=RequireNewPassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Button","Grid","Heading","Input","Form","Bind","validation","View","sentenceCase","str","lower","toLowerCase","toUpperCase","substring","RequireNewPassword","props","vm","onSubmit","createElement","Container","data","password","requiredAttributes","submitOnEnter","submit","Content","Title","title","Column","span","name","validators","create","type","label","autoComplete","length","Fragment","level","className","map","attr","key","text","onClick","size","disabled","isLoading"],"sources":["RequireNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Heading, Input } from \"@webiny/admin-ui\";\nimport { Form, Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { RequireNewPasswordVM } from \"~/admin/presentation/Cognito/abstractions.js\";\n\nconst sentenceCase = (str: string) => {\n const lower = str.toLowerCase();\n return lower[0].toUpperCase() + lower.substring(1);\n};\n\nexport interface RequireNewPasswordProps {\n vm: RequireNewPasswordVM;\n onSubmit: (password: string, attributes: any) => void;\n onCancel: () => void;\n}\n\ntype FormData = {\n password: string;\n requiredAttributes: Record<string, string>;\n};\n\nexport const RequireNewPassword = (props: RequireNewPasswordProps) => {\n const { vm, onSubmit } = props;\n\n return (\n <View.Container>\n <Form<FormData>\n onSubmit={data => onSubmit(data.password, data.requiredAttributes)}\n submitOnEnter\n >\n {({ submit }) => (\n <View.Content>\n <View.Title title={\"Set new password\"} />\n <Grid>\n <Grid.Column span={12}>\n <Bind name=\"password\" validators={validation.create(\"required\")}>\n <Input\n type={\"password\"}\n label={\"New password\"}\n autoComplete={\"off\"}\n />\n </Bind>\n </Grid.Column>\n\n {vm.requiredAttributes.length > 0 ? (\n <>\n <Grid.Column span={12}>\n <Heading level={6} className={\"text-center\"}>\n Please enter additional information\n </Heading>\n </Grid.Column>\n {vm.requiredAttributes.map(attr => (\n <Grid.Column key={attr} span={12}>\n <Bind name={`requiredAttributes.${attr}`}>\n <Input label={sentenceCase(attr)} />\n </Bind>\n </Grid.Column>\n ))}\n </>\n ) : (\n <></>\n )}\n\n <Grid.Column span={12}>\n <div\n className={\"flex flex-row-reverse items-center justify-between\"}\n >\n <Button\n text={\"Confirm\"}\n onClick={submit}\n size=\"lg\"\n disabled={vm.isLoading}\n />\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,KAAK,QAAQ,kBAAkB;AAC/D,SAASC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACzC,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,IAAI;AAGb,MAAMC,YAAY,GAAIC,GAAW,IAAK;EAClC,MAAMC,KAAK,GAAGD,GAAG,CAACE,WAAW,CAAC,CAAC;EAC/B,OAAOD,KAAK,CAAC,CAAC,CAAC,CAACE,WAAW,CAAC,CAAC,GAAGF,KAAK,CAACG,SAAS,CAAC,CAAC,CAAC;AACtD,CAAC;AAaD,OAAO,MAAMC,kBAAkB,GAAIC,KAA8B,IAAK;EAClE,MAAM;IAAEC,EAAE;IAAEC;EAAS,CAAC,GAAGF,KAAK;EAE9B,oBACIhB,KAAA,CAAAmB,aAAA,CAACX,IAAI,CAACY,SAAS,qBACXpB,KAAA,CAAAmB,aAAA,CAACd,IAAI;IACDa,QAAQ,EAAEG,IAAI,IAAIH,QAAQ,CAACG,IAAI,CAACC,QAAQ,EAAED,IAAI,CAACE,kBAAkB,CAAE;IACnEC,aAAa;EAAA,GAEZ,CAAC;IAAEC;EAAO,CAAC,kBACRzB,KAAA,CAAAmB,aAAA,CAACX,IAAI,CAACkB,OAAO,qBACT1B,KAAA,CAAAmB,aAAA,CAACX,IAAI,CAACmB,KAAK;IAACC,KAA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I,EAAE;EAAG,gBAClB9B,KAAA,CAAAmB,aAAA;IACIqB,SAAS,EAAE;EAAqD,gBAEhExC,KAAA,CAAAmB,aAAA,CAAClB,MAAM;IACH2C,IAAI,EAAE,SAAU;IAChBC,OAAO,EAAEpB,MAAO;IAChBqB,IAAI,EAAC,IAAI;IACTC,QAAQ,EAAE9B,EAAE,CAAC+B;EAAU,CAC1B,CACA,CACI,CACX,CACI,CAEhB,CACM,CAAC;AAEzB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SetNewPasswordVM } from "../../../../admin/presentation/Cognito/abstractions.js";
|
|
3
|
+
export interface SetNewPasswordProps {
|
|
4
|
+
vm: SetNewPasswordVM;
|
|
5
|
+
onSetNewPassword: (code: string, password: string) => void;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const SetNewPassword: (props: SetNewPasswordProps) => React.JSX.Element;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, Grid, Input, Alert } from "@webiny/admin-ui";
|
|
3
|
+
import { Form, Bind, useForm } from "@webiny/form";
|
|
4
|
+
import { validation } from "@webiny/validation";
|
|
5
|
+
import { View } from "./View.js";
|
|
6
|
+
import { FooterSignIn } from "./FooterSignIn.js";
|
|
7
|
+
import { usePasswordValidator } from "../../shared/usePasswordValidator.js";
|
|
8
|
+
export const SetNewPassword = props => {
|
|
9
|
+
const {
|
|
10
|
+
vm,
|
|
11
|
+
onSetNewPassword,
|
|
12
|
+
onCancel
|
|
13
|
+
} = props;
|
|
14
|
+
const passwordValidator = usePasswordValidator();
|
|
15
|
+
return /*#__PURE__*/React.createElement(View.Container, null, /*#__PURE__*/React.createElement(Form, {
|
|
16
|
+
onSubmit: data => onSetNewPassword(data.code, data.password),
|
|
17
|
+
submitOnEnter: true
|
|
18
|
+
}, ({
|
|
19
|
+
submit
|
|
20
|
+
}) => /*#__PURE__*/React.createElement(View.Content, null, /*#__PURE__*/React.createElement(View.Title, {
|
|
21
|
+
title: "Set new password"
|
|
22
|
+
}), vm.message && /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: "mb-lg"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Alert, {
|
|
25
|
+
title: vm.message.title,
|
|
26
|
+
type: vm.message.type
|
|
27
|
+
}, vm.message.text)), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
28
|
+
span: 12
|
|
29
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
30
|
+
name: "code",
|
|
31
|
+
validators: validation.create("required")
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
33
|
+
label: "Verification Code",
|
|
34
|
+
description: "Enter the code we sent to your email.",
|
|
35
|
+
autoComplete: "new-password"
|
|
36
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
37
|
+
span: 12
|
|
38
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
39
|
+
name: "password",
|
|
40
|
+
validators: [validation.create("required"), passwordValidator]
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
42
|
+
type: "password",
|
|
43
|
+
label: "New Password",
|
|
44
|
+
description: "Enter your new password.",
|
|
45
|
+
autoComplete: "new-password"
|
|
46
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
47
|
+
span: 12
|
|
48
|
+
}, /*#__PURE__*/React.createElement(RetypePassword, null)), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
49
|
+
span: 12
|
|
50
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "flex items-center justify-between"
|
|
52
|
+
}, /*#__PURE__*/React.createElement(FooterSignIn, {
|
|
53
|
+
onSignIn: onCancel
|
|
54
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
55
|
+
text: "Reset Password",
|
|
56
|
+
onClick: submit,
|
|
57
|
+
containerClassName: "ml-auto",
|
|
58
|
+
disabled: vm.isLoading
|
|
59
|
+
})))))));
|
|
60
|
+
};
|
|
61
|
+
const RetypePassword = () => {
|
|
62
|
+
const form = useForm();
|
|
63
|
+
const matchOriginalValidator = value => {
|
|
64
|
+
if (value !== form.getValue("password")) {
|
|
65
|
+
throw Error(`Passwords do not match.`);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
return /*#__PURE__*/React.createElement(Bind, {
|
|
69
|
+
name: "confirmPassword",
|
|
70
|
+
validators: [validation.create("required"), matchOriginalValidator]
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
72
|
+
type: "password",
|
|
73
|
+
label: "Retype Password",
|
|
74
|
+
description: "Enter your new password once more.",
|
|
75
|
+
autoComplete: "new-password"
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=SetNewPassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Button","Grid","Input","Alert","Form","Bind","useForm","validation","View","FooterSignIn","usePasswordValidator","SetNewPassword","props","vm","onSetNewPassword","onCancel","passwordValidator","createElement","Container","onSubmit","data","code","password","submitOnEnter","submit","Content","Title","title","message","className","type","text","Column","span","name","validators","create","label","description","autoComplete","RetypePassword","onSignIn","onClick","containerClassName","disabled","isLoading","form","matchOriginalValidator","value","getValue","Error"],"sources":["SetNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Input, Alert } from \"@webiny/admin-ui\";\nimport { Form, Bind, useForm } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { SetNewPasswordVM } from \"~/admin/presentation/Cognito/abstractions.js\";\nimport { FooterSignIn } from \"~/admin/presentation/Cognito/components/FooterSignIn.js\";\nimport { usePasswordValidator } from \"~/admin/presentation/shared/usePasswordValidator.js\";\n\nexport interface SetNewPasswordProps {\n vm: SetNewPasswordVM;\n onSetNewPassword: (code: string, password: string) => void;\n onCancel: () => void;\n}\n\nexport const SetNewPassword = (props: SetNewPasswordProps) => {\n const { vm, onSetNewPassword, onCancel } = props;\n const passwordValidator = usePasswordValidator();\n\n return (\n <View.Container>\n <Form\n onSubmit={(data: any) => onSetNewPassword(data.code, data.password)}\n submitOnEnter\n >\n {({ submit }) => (\n <View.Content>\n <View.Title title={\"Set new password\"} />\n\n {vm.message && (\n <div className={\"mb-lg\"}>\n <Alert title={vm.message.title} type={vm.message.type}>\n {vm.message.text}\n </Alert>\n </div>\n )}\n\n <Grid>\n <Grid.Column span={12}>\n <Bind name=\"code\" validators={validation.create(\"required\")}>\n <Input\n label={\"Verification Code\"}\n description={\"Enter the code we sent to your email.\"}\n autoComplete={\"new-password\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name=\"password\"\n validators={[validation.create(\"required\"), passwordValidator]}\n >\n <Input\n type={\"password\"}\n label={\"New Password\"}\n description={\"Enter your new password.\"}\n autoComplete={\"new-password\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <RetypePassword />\n </Grid.Column>\n <Grid.Column span={12}>\n <div className={\"flex items-center justify-between\"}>\n <FooterSignIn onSignIn={onCancel} />\n <Button\n text={\"Reset Password\"}\n onClick={submit}\n containerClassName={\"ml-auto\"}\n disabled={vm.isLoading}\n />\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n};\n\nconst RetypePassword = () => {\n const form = useForm();\n const matchOriginalValidator = (value: string) => {\n if (value !== form.getValue(\"password\")) {\n throw Error(`Passwords do not match.`);\n }\n };\n\n return (\n <Bind\n name=\"confirmPassword\"\n validators={[validation.create(\"required\"), matchOriginalValidator]}\n >\n <Input\n type={\"password\"}\n label={\"Retype Password\"}\n description={\"Enter your new password once more.\"}\n autoComplete={\"new-password\"}\n />\n </Bind>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,EAAEC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AAMM,IAAI,GAAGxC,OAAO,CAAC,CAAC;EACtB,MAAMyC,sBAAsB,GAAIC,KAAa,IAAK;IAC9C,IAAIA,KAAK,KAAKF,IAAI,CAACG,QAAQ,CAAC,UAAU,CAAC,EAAE;MACrC,MAAMC,KAAK,CAAC,yBAAyB,CAAC;IAC1C;EACJ,CAAC;EAED,oBACInD,KAAA,CAAAkB,aAAA,CAACZ,IAAI;IACD6B,IAAI,EAAC,iBAAiB;IACtBC,UAAU,EAAE,CAAC5B,UAAU,CAAC6B,MAAM,CAAC,UAAU,CAAC,EAAEW,sBAAsB;EAAE,gBAEpEhD,KAAA,CAAAkB,aAAA,CAACf,KAAK;IACF4B,IAAI,EAAE,UAAW;IACjBO,KAAK,EAAE,iBAAkB;IACzBC,WAAW,EAAE,oCAAqC;IAClDC,YAAY,EAAE;EAAe,CAChC,CACC,CAAC;AAEf,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SignInVM } from "../../../../admin/presentation/Cognito/abstractions.js";
|
|
3
|
+
export interface SignInProps {
|
|
4
|
+
vm: SignInVM;
|
|
5
|
+
onSubmit: (username: string, password: string) => void;
|
|
6
|
+
onForgotPassword: () => void;
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const SignIn: (props: SignInProps) => React.JSX.Element;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Grid, Input, Alert, Link, Button, Text, OverlayLoader } from "@webiny/admin-ui";
|
|
3
|
+
import { Form, Bind } from "@webiny/form";
|
|
4
|
+
import { validation } from "@webiny/validation";
|
|
5
|
+
import { View } from "./View.js";
|
|
6
|
+
export const SignIn = props => {
|
|
7
|
+
const {
|
|
8
|
+
vm,
|
|
9
|
+
onSubmit,
|
|
10
|
+
onForgotPassword,
|
|
11
|
+
title = "Sign in",
|
|
12
|
+
description
|
|
13
|
+
} = props;
|
|
14
|
+
return /*#__PURE__*/React.createElement(View.Container, null, /*#__PURE__*/React.createElement(Form, {
|
|
15
|
+
onSubmit: data => onSubmit(data.username, data.password),
|
|
16
|
+
submitOnEnter: true
|
|
17
|
+
}, ({
|
|
18
|
+
submit
|
|
19
|
+
}) => /*#__PURE__*/React.createElement(View.Content, null, vm.isLoading ? /*#__PURE__*/React.createElement(OverlayLoader, {
|
|
20
|
+
text: "Authenticating..."
|
|
21
|
+
}) : null, /*#__PURE__*/React.createElement(View.Title, {
|
|
22
|
+
title: title,
|
|
23
|
+
description: description
|
|
24
|
+
}), vm.message && /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: "mb-lg"
|
|
26
|
+
}, /*#__PURE__*/React.createElement(Alert, {
|
|
27
|
+
title: vm.message.title,
|
|
28
|
+
type: vm.message.type
|
|
29
|
+
}, vm.message.text)), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
30
|
+
span: 12
|
|
31
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
32
|
+
name: "username",
|
|
33
|
+
validators: validation.create("required,email"),
|
|
34
|
+
beforeChange: (val, cb) => cb(val.toLowerCase())
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
36
|
+
label: "Email"
|
|
37
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
38
|
+
span: 12
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
40
|
+
name: "password",
|
|
41
|
+
validators: validation.create("required")
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
43
|
+
type: "password",
|
|
44
|
+
label: "Password",
|
|
45
|
+
autoComplete: "off"
|
|
46
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
47
|
+
span: 12
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "flex flex-row-reverse items-center justify-between"
|
|
50
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
51
|
+
text: "Submit",
|
|
52
|
+
"data-testid": "submit-sign-in-form-button",
|
|
53
|
+
onClick: submit,
|
|
54
|
+
disabled: vm.isLoading
|
|
55
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
56
|
+
as: "div",
|
|
57
|
+
size: "sm"
|
|
58
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
59
|
+
to: "#",
|
|
60
|
+
onClick: onForgotPassword
|
|
61
|
+
}, "Forgot password?"))))))));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=SignIn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Grid","Input","Alert","Link","Button","Text","OverlayLoader","Form","Bind","validation","View","SignIn","props","vm","onSubmit","onForgotPassword","title","description","createElement","Container","data","username","password","submitOnEnter","submit","Content","isLoading","text","Title","message","className","type","Column","span","name","validators","create","beforeChange","val","cb","toLowerCase","label","autoComplete","onClick","disabled","as","size","to"],"sources":["SignIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { Grid, Input, Alert, Link, Button, Text, OverlayLoader } from \"@webiny/admin-ui\";\nimport { Form, Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"./View.js\";\nimport type { SignInVM } from \"~/admin/presentation/Cognito/abstractions.js\";\n\nexport interface SignInProps {\n vm: SignInVM;\n onSubmit: (username: string, password: string) => void;\n onForgotPassword: () => void;\n title?: string;\n description?: React.ReactNode;\n}\n\nexport const SignIn = (props: SignInProps) => {\n const { vm, onSubmit, onForgotPassword, title = \"Sign in\", description } = props;\n\n return (\n <View.Container>\n <Form onSubmit={(data: any) => onSubmit(data.username, data.password)} submitOnEnter>\n {({ submit }) => (\n <View.Content>\n {vm.isLoading ? <OverlayLoader text={\"Authenticating...\"} /> : null}\n <View.Title title={title} description={description} />\n\n {vm.message && (\n <div className={\"mb-lg\"}>\n <Alert title={vm.message.title} type={vm.message.type}>\n {vm.message.text}\n </Alert>\n </div>\n )}\n\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name=\"username\"\n validators={validation.create(\"required,email\")}\n beforeChange={(val: string, cb: (value: string) => void) =>\n cb(val.toLowerCase())\n }\n >\n <Input label={\"Email\"} />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind name=\"password\" validators={validation.create(\"required\")}>\n <Input\n type={\"password\"}\n label={\"Password\"}\n autoComplete={\"off\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div\n className={\"flex flex-row-reverse items-center justify-between\"}\n >\n <Button\n text={\"Submit\"}\n data-testid=\"submit-sign-in-form-button\"\n onClick={submit}\n disabled={vm.isLoading}\n />\n <Text as={\"div\"} size={\"sm\"}>\n <Link to=\"#\" onClick={onForgotPassword}>\n Forgot password?\n </Link>\n </Text>\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,EAAEC,aAAa,QAAQ,kBAAkB;AACxF,SAASC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACzC,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,IAAI;AAWb,OAAO,MAAMC,MAAM,GAAIC,KAAkB,IAAK;EAC1C,MAAM;IAAEC,EAAE;IAAEC,QAAQ;IAAEC,gBAAgB;IAAEC,KAAK,GAAG,SAAS;IAAEC;EAAY,CAAC,GAAGL,KAAK;EAEhF,oBACIb,KAAA,CAAAmB,aAAA,CAACR,IAAI,CAACS,SAAS,qBACXpB,KAAA,CAAAmB,aAAA,CAACX,IAAI;IAACO,QAAQ,EAAGM,IAAS,IAAKN,QAAQ,CAACM,IAAI,CAACC,QAAQ,EAAED,IAAI,CAACE,QAAQ,CAAE;IAACC,aAAa;EAAA,GAC/E,CAAC;IA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BAC5DrC,KAAA,CAAAmB,aAAA,CAACjB,KAAK;IACF8B,IAAI,EAAE,UAAW;IACjBU,KAAK,EAAE,UAAW;IAClBC,YAAY,EAAE;EAAM,CACvB,CACC,CACG,CAAC,eACd3C,KAAA,CAAAmB,aAAA,CAAClB,IAAI,CAACgC,MAAM;IAACC,IAAI,EAAE;EAAG,gBAClBlC,KAAA,CAAAmB,aAAA;IACIY,SAAS,EAAE;EAAqD,gBAEhE/B,KAAA,CAAAmB,aAAA,CAACd,MAAM;IACHuB,IAAI,EAAE,QAAS;IACf,eAAY,4BAA4B;IACxCgB,OAAO,EAAEnB,MAAO;IAChBoB,QAAQ,EAAE/B,EAAE,CAACa;EAAU,CAC1B,CAAC,eACF3B,KAAA,CAAAmB,aAAA,CAACb,IAAI;IAACwC,EAAE,EAAE,KAAM;IAACC,IAAI,EAAE;EAAK,gBACxB/C,KAAA,CAAAmB,aAAA,CAACf,IAAI;IAAC4C,EAAE,EAAC,GAAG;IAACJ,OAAO,EAAE5B;EAAiB,GAAC,kBAElC,CACJ,CACL,CACI,CACX,CACI,CAEhB,CACM,CAAC;AAEzB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ContainerProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export interface ContentProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface FooterProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface TitleProps {
|
|
12
|
+
title: string;
|
|
13
|
+
description?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export interface ErrorProps {
|
|
16
|
+
title?: string;
|
|
17
|
+
description?: string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare const Error: ({ title, description }: ErrorProps) => React.JSX.Element | null;
|
|
20
|
+
export declare const View: {
|
|
21
|
+
Container: (({ children }: ContainerProps) => React.JSX.Element) & {
|
|
22
|
+
original: ({ children }: ContainerProps) => React.JSX.Element;
|
|
23
|
+
originalName: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
} & {
|
|
26
|
+
original: (({ children }: ContainerProps) => React.JSX.Element) & {
|
|
27
|
+
original: ({ children }: ContainerProps) => React.JSX.Element;
|
|
28
|
+
originalName: string;
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
31
|
+
originalName: string;
|
|
32
|
+
displayName: string;
|
|
33
|
+
} & {
|
|
34
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ children }: ContainerProps) => React.JSX.Element) & {
|
|
35
|
+
original: ({ children }: ContainerProps) => React.JSX.Element;
|
|
36
|
+
originalName: string;
|
|
37
|
+
displayName: string;
|
|
38
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
39
|
+
};
|
|
40
|
+
Content: (({ children }: ContentProps) => React.JSX.Element) & {
|
|
41
|
+
original: ({ children }: ContentProps) => React.JSX.Element;
|
|
42
|
+
originalName: string;
|
|
43
|
+
displayName: string;
|
|
44
|
+
} & {
|
|
45
|
+
original: (({ children }: ContentProps) => React.JSX.Element) & {
|
|
46
|
+
original: ({ children }: ContentProps) => React.JSX.Element;
|
|
47
|
+
originalName: string;
|
|
48
|
+
displayName: string;
|
|
49
|
+
};
|
|
50
|
+
originalName: string;
|
|
51
|
+
displayName: string;
|
|
52
|
+
} & {
|
|
53
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ children }: ContentProps) => React.JSX.Element) & {
|
|
54
|
+
original: ({ children }: ContentProps) => React.JSX.Element;
|
|
55
|
+
originalName: string;
|
|
56
|
+
displayName: string;
|
|
57
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
58
|
+
};
|
|
59
|
+
Title: (({ title, description }: TitleProps) => React.JSX.Element) & {
|
|
60
|
+
original: ({ title, description }: TitleProps) => React.JSX.Element;
|
|
61
|
+
originalName: string;
|
|
62
|
+
displayName: string;
|
|
63
|
+
} & {
|
|
64
|
+
original: (({ title, description }: TitleProps) => React.JSX.Element) & {
|
|
65
|
+
original: ({ title, description }: TitleProps) => React.JSX.Element;
|
|
66
|
+
originalName: string;
|
|
67
|
+
displayName: string;
|
|
68
|
+
};
|
|
69
|
+
originalName: string;
|
|
70
|
+
displayName: string;
|
|
71
|
+
} & {
|
|
72
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ title, description }: TitleProps) => React.JSX.Element) & {
|
|
73
|
+
original: ({ title, description }: TitleProps) => React.JSX.Element;
|
|
74
|
+
originalName: string;
|
|
75
|
+
displayName: string;
|
|
76
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
77
|
+
};
|
|
78
|
+
Footer: (({ children }: FooterProps) => React.JSX.Element) & {
|
|
79
|
+
original: ({ children }: FooterProps) => React.JSX.Element;
|
|
80
|
+
originalName: string;
|
|
81
|
+
displayName: string;
|
|
82
|
+
} & {
|
|
83
|
+
original: (({ children }: FooterProps) => React.JSX.Element) & {
|
|
84
|
+
original: ({ children }: FooterProps) => React.JSX.Element;
|
|
85
|
+
originalName: string;
|
|
86
|
+
displayName: string;
|
|
87
|
+
};
|
|
88
|
+
originalName: string;
|
|
89
|
+
displayName: string;
|
|
90
|
+
} & {
|
|
91
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ children }: FooterProps) => React.JSX.Element) & {
|
|
92
|
+
original: ({ children }: FooterProps) => React.JSX.Element;
|
|
93
|
+
originalName: string;
|
|
94
|
+
displayName: string;
|
|
95
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
96
|
+
};
|
|
97
|
+
Error: ({ title, description }: ErrorProps) => React.JSX.Element | null;
|
|
98
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import capitalize from "lodash/capitalize";
|
|
3
|
+
import { Logo, makeDecoratable } from "@webiny/app-admin";
|
|
4
|
+
import { Alert, Grid, Heading, Text } from "@webiny/admin-ui";
|
|
5
|
+
const Container = makeDecoratable("ViewContainer", ({
|
|
6
|
+
children
|
|
7
|
+
}) => {
|
|
8
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
className: "w-full h-screen bg-neutral-light flex-1"
|
|
10
|
+
}, /*#__PURE__*/React.createElement("section", {
|
|
11
|
+
className: "m-auto flex flex-col justify-center min-h-screen"
|
|
12
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
className: "mx-auto"
|
|
14
|
+
}, /*#__PURE__*/React.createElement(Logo, null)), /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: "w-full max-w-[480px] mx-auto my-lg"
|
|
16
|
+
}, children)));
|
|
17
|
+
});
|
|
18
|
+
const Content = makeDecoratable("ViewContent", ({
|
|
19
|
+
children
|
|
20
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "relative p-lg pt-md bg-neutral-base rounded-xl"
|
|
22
|
+
}, children));
|
|
23
|
+
const Footer = makeDecoratable("ViewFooter", ({
|
|
24
|
+
children
|
|
25
|
+
}) => {
|
|
26
|
+
return /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
27
|
+
span: 12,
|
|
28
|
+
className: "text-center mt-lg"
|
|
29
|
+
}, children));
|
|
30
|
+
});
|
|
31
|
+
const Title = makeDecoratable("ViewTitle", ({
|
|
32
|
+
title,
|
|
33
|
+
description
|
|
34
|
+
}) => {
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: "mb-md"
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
38
|
+
level: 4
|
|
39
|
+
}, capitalize(title)), description && /*#__PURE__*/React.createElement(Text, {
|
|
40
|
+
as: "div",
|
|
41
|
+
size: "sm",
|
|
42
|
+
className: "text-neutral-strong"
|
|
43
|
+
}, description));
|
|
44
|
+
});
|
|
45
|
+
export const Error = ({
|
|
46
|
+
title = "Something went wrong",
|
|
47
|
+
description
|
|
48
|
+
}) => {
|
|
49
|
+
if (!description) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: "mb-lg"
|
|
54
|
+
}, /*#__PURE__*/React.createElement(Alert, {
|
|
55
|
+
title: title,
|
|
56
|
+
type: "danger"
|
|
57
|
+
}, description));
|
|
58
|
+
};
|
|
59
|
+
export const View = {
|
|
60
|
+
Container,
|
|
61
|
+
Content,
|
|
62
|
+
Title,
|
|
63
|
+
Footer,
|
|
64
|
+
Error
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=View.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","capitalize","Logo","makeDecoratable","Alert","Grid","Heading","Text","Container","children","createElement","className","Content","Footer","Column","span","Title","title","description","level","as","size","Error","type","View"],"sources":["View.tsx"],"sourcesContent":["import * as React from \"react\";\nimport capitalize from \"lodash/capitalize\";\nimport { Logo, makeDecoratable } from \"@webiny/app-admin\";\nimport { Alert, Grid, Heading, Text } from \"@webiny/admin-ui\";\n\nexport interface ContainerProps {\n children: React.ReactNode;\n}\n\nconst Container = makeDecoratable(\"ViewContainer\", ({ children }: ContainerProps) => {\n return (\n <div className={\"w-full h-screen bg-neutral-light flex-1\"}>\n <section className={\"m-auto flex flex-col justify-center min-h-screen\"}>\n <div className={\"mx-auto\"}>\n <Logo />\n </div>\n <div className={\"w-full max-w-[480px] mx-auto my-lg\"}>{children}</div>\n </section>\n </div>\n );\n});\n\nexport interface ContentProps {\n children: React.ReactNode;\n}\n\nconst Content = makeDecoratable(\"ViewContent\", ({ children }: ContentProps) => (\n <div className={\"relative p-lg pt-md bg-neutral-base rounded-xl\"}>{children}</div>\n));\n\nexport interface FooterProps {\n children: React.ReactNode;\n}\n\nconst Footer = makeDecoratable(\"ViewFooter\", ({ children }: FooterProps) => {\n return (\n <Grid>\n <Grid.Column span={12} className={\"text-center mt-lg\"}>\n {children}\n </Grid.Column>\n </Grid>\n );\n});\n\nexport interface TitleProps {\n title: string;\n description?: React.ReactNode;\n}\n\nconst Title = makeDecoratable(\"ViewTitle\", ({ title, description }: TitleProps) => {\n return (\n <div className={\"mb-md\"}>\n <Heading level={4}>{capitalize(title)}</Heading>\n {description && (\n <Text as={\"div\"} size={\"sm\"} className={\"text-neutral-strong\"}>\n {description}\n </Text>\n )}\n </div>\n );\n});\n\nexport interface ErrorProps {\n title?: string;\n description?: string | null;\n}\n\nexport const Error = ({ title = \"Something went wrong\", description }: ErrorProps) => {\n if (!description) {\n return null;\n }\n\n return (\n <div className={\"mb-lg\"}>\n <Alert title={title} type={\"danger\"}>\n {description}\n </Alert>\n </div>\n );\n};\n\nexport const View = {\n Container,\n Content,\n Title,\n Footer,\n Error\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,SAASC,IAAI,EAAEC,eAAe,QAAQ,mBAAmB;AACzD,SAASC,KAAK,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI,QAAQ,kBAAkB;AAM7D,MAAMC,SAAS,GAAGL,eAAe,CAAC,eAAe,EAAE,CAAC;EAAEM;AAAyB,CAAC,KAAK;EACjF,oBACIT,KAAA,CAAAU,aAAA;IAAKC,SAAS,EAAE;EAA0C,gBACtDX,KAAA,CAAAU,aAAA;IAASC,SAAS,EAAE;EAAmD,gBACnEX,KAAA,CAAAU,aAAA;IAAKC,SAAS,EAAE;EAAU,gBACtBX,KAAA,CAAAU,aAAA,CAACR,IAAI,MAAE,CACN,CAAC,eACNF,KAAA,CAAAU,aAAA;IAAKC,SAAS,EAAE;EAAqC,GAAEF,QAAc,CAChE,CACR,CAAC;AAEd,CAAC,CAAC;AAMF,MAAMG,OAAO,GAAGT,eAAe,CAAC,aAAa,EAAE,CAAC;EAAEM;AAAuB,CAAC,kBACtET,KAAA,CAAAU,aAAA;EAAKC,SAAS,EAA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ature/admin";
|
|
2
|
+
import { CognitoPresenter } from "./CognitoPresenter.js";
|
|
3
|
+
import { CognitoPresenter as Presenter } from "./abstractions.js";
|
|
4
|
+
export const CognitoFeature = createFeature({
|
|
5
|
+
name: "Cognito",
|
|
6
|
+
register(container) {
|
|
7
|
+
container.register(CognitoPresenter).inSingletonScope();
|
|
8
|
+
},
|
|
9
|
+
resolve(container) {
|
|
10
|
+
return {
|
|
11
|
+
presenter: container.resolve(Presenter)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","CognitoPresenter","Presenter","CognitoFeature","name","register","container","inSingletonScope","resolve","presenter"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { CognitoPresenter } from \"./CognitoPresenter.js\";\nimport { CognitoPresenter as Presenter } from \"./abstractions.js\";\n\nexport const CognitoFeature = createFeature({\n name: \"Cognito\",\n register(container) {\n container.register(CognitoPresenter).inSingletonScope();\n },\n resolve(container) {\n return {\n presenter: container.resolve(Presenter)\n };\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,gBAAgB;AACzB,SAASA,gBAAgB,IAAIC,SAAS;AAEtC,OAAO,MAAMC,cAAc,GAAGH,aAAa,CAAC;EACxCI,IAAI,EAAE,SAAS;EACfC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACJ,gBAAgB,CAAC,CAACM,gBAAgB,CAAC,CAAC;EAC3D,CAAC;EACDC,OAAOA,CAACF,SAAS,EAAE;IACf,OAAO;MACHG,SAAS,EAAEH,SAAS,CAACE,OAAO,CAACN,SAAS;IAC1C,CAAC;EACL;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface PasswordPolicy {
|
|
2
|
+
minimumLength?: number;
|
|
3
|
+
requireLowercase?: boolean;
|
|
4
|
+
requireNumbers?: boolean;
|
|
5
|
+
requireSymbols?: boolean;
|
|
6
|
+
requireUppercase?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const createPasswordValidator: (policy: PasswordPolicy) => (value?: string) => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ValidationError } from "@webiny/validation";
|
|
2
|
+
export const createPasswordValidator = policy => value => {
|
|
3
|
+
if (!value) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const requireSymbols = /([=+\-^$*.\[\]{}()?"!@#%&/,><':;|_~`])+/;
|
|
7
|
+
const requireNumber = /[0-9]/;
|
|
8
|
+
const requireLowercase = /[a-z]/;
|
|
9
|
+
const requireUppercase = /[A-Z]/;
|
|
10
|
+
if (policy.minimumLength !== undefined && value.length < policy.minimumLength) {
|
|
11
|
+
throw new ValidationError(`Value requires at least ${policy.minimumLength} characters.`);
|
|
12
|
+
}
|
|
13
|
+
if (policy.requireLowercase && !requireLowercase.test(value)) {
|
|
14
|
+
throw new ValidationError("Value must contain a lowercase character.");
|
|
15
|
+
}
|
|
16
|
+
if (policy.requireNumbers && !requireNumber.test(value)) {
|
|
17
|
+
throw new ValidationError("Value must contain a number.");
|
|
18
|
+
}
|
|
19
|
+
if (policy.requireUppercase && !requireUppercase.test(value)) {
|
|
20
|
+
throw new ValidationError("Value must contain an uppercase character.");
|
|
21
|
+
}
|
|
22
|
+
if (policy.requireSymbols && !requireSymbols.test(value)) {
|
|
23
|
+
throw new ValidationError("Value must contain a special character.");
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=createPasswordValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ValidationError","createPasswordValidator","policy","value","requireSymbols","requireNumber","requireLowercase","requireUppercase","minimumLength","undefined","length","test","requireNumbers"],"sources":["createPasswordValidator.ts"],"sourcesContent":["import { ValidationError } from \"@webiny/validation\";\n\nexport interface PasswordPolicy {\n minimumLength?: number;\n requireLowercase?: boolean;\n requireNumbers?: boolean;\n requireSymbols?: boolean;\n requireUppercase?: boolean;\n}\n\nexport const createPasswordValidator =\n (policy: PasswordPolicy) =>\n (value?: string): void => {\n if (!value) {\n return;\n }\n\n const requireSymbols = /([=+\\-^$*.\\[\\]{}()?\"!@#%&/,><':;|_~`])+/;\n const requireNumber = /[0-9]/;\n const requireLowercase = /[a-z]/;\n const requireUppercase = /[A-Z]/;\n\n if (policy.minimumLength !== undefined && value.length < policy.minimumLength) {\n throw new ValidationError(\n `Value requires at least ${policy.minimumLength} characters.`\n );\n }\n\n if (policy.requireLowercase && !requireLowercase.test(value)) {\n throw new ValidationError(\"Value must contain a lowercase character.\");\n }\n\n if (policy.requireNumbers && !requireNumber.test(value)) {\n throw new ValidationError(\"Value must contain a number.\");\n }\n\n if (policy.requireUppercase && !requireUppercase.test(value)) {\n throw new ValidationError(\"Value must contain an uppercase character.\");\n }\n\n if (policy.requireSymbols && !requireSymbols.test(value)) {\n throw new ValidationError(\"Value must contain a special character.\");\n }\n };\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,oBAAoB;AAUpD,OAAO,MAAMC,uBAAuB,GAC/BC,MAAsB,IACtBC,KAAc,IAAW;EACtB,IAAI,CAACA,KAAK,EAAE;IACR;EACJ;EAEA,MAAMC,cAAc,GAAG,yCAAyC;EAChE,MAAMC,aAAa,GAAG,OAAO;EAC7B,MAAMC,gBAAgB,GAAG,OAAO;EAChC,MAAMC,gBAAgB,GAAG,OAAO;EAEhC,IAAIL,MAAM,CAACM,aAAa,KAAKC,SAAS,IAAIN,KAAK,CAACO,MAAM,GAAGR,MAAM,CAACM,aAAa,EAAE;IAC3E,MAAM,IAAIR,eAAe,CACrB,2BAA2BE,MAAM,CAACM,aAAa,cACnD,CAAC;EACL;EAEA,IAAIN,MAAM,CAACI,gBAAgB,IAAI,CAACA,gBAAgB,CAACK,IAAI,CAACR,KAAK,CAAC,EAAE;IAC1D,MAAM,IAAIH,eAAe,CAAC,2CAA2C,CAAC;EAC1E;EAEA,IAAIE,MAAM,CAACU,cAAc,IAAI,CAACP,aAAa,CAACM,IAAI,CAACR,KAAK,CAAC,EAAE;IACrD,MAAM,IAAIH,eAAe,CAAC,8BAA8B,CAAC;EAC7D;EAEA,IAAIE,MAAM,CAACK,gBAAgB,IAAI,CAACA,gBAAgB,CAACI,IAAI,CAACR,KAAK,CAAC,EAAE;IAC1D,MAAM,IAAIH,eAAe,CAAC,4CAA4C,CAAC;EAC3E;EAEA,IAAIE,MAAM,CAACE,cAAc,IAAI,CAACA,cAAc,CAACO,IAAI,CAACR,KAAK,CAAC,EAAE;IACtD,MAAM,IAAIH,eAAe,CAAC,yCAAyC,CAAC;EACxE;AACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function usePasswordValidator(): (value?: string) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { config as appConfig } from "@webiny/app/config.js";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { createPasswordValidator } from "./createPasswordValidator.js";
|
|
4
|
+
export function usePasswordValidator() {
|
|
5
|
+
let envPasswordValidatorPolicy;
|
|
6
|
+
try {
|
|
7
|
+
envPasswordValidatorPolicy = JSON.parse(process.env.REACT_APP_USER_POOL_PASSWORD_POLICY);
|
|
8
|
+
} catch {
|
|
9
|
+
// Do nothing.
|
|
10
|
+
}
|
|
11
|
+
const passwordValidatorPolicy = appConfig.getKey("USER_POOL_PASSWORD_POLICY", envPasswordValidatorPolicy);
|
|
12
|
+
return useMemo(() => createPasswordValidator(passwordValidatorPolicy), [passwordValidatorPolicy]);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=usePasswordValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["config","appConfig","useMemo","createPasswordValidator","usePasswordValidator","envPasswordValidatorPolicy","JSON","parse","process","env","REACT_APP_USER_POOL_PASSWORD_POLICY","passwordValidatorPolicy","getKey"],"sources":["usePasswordValidator.ts"],"sourcesContent":["import { config as appConfig } from \"@webiny/app/config.js\";\nimport { useMemo } from \"react\";\nimport { createPasswordValidator, type PasswordPolicy } from \"./createPasswordValidator.js\";\n\nexport function usePasswordValidator() {\n let envPasswordValidatorPolicy;\n try {\n envPasswordValidatorPolicy = JSON.parse(\n process.env.REACT_APP_USER_POOL_PASSWORD_POLICY as string\n );\n } catch {\n // Do nothing.\n }\n\n const passwordValidatorPolicy = appConfig.getKey<PasswordPolicy>(\n \"USER_POOL_PASSWORD_POLICY\",\n envPasswordValidatorPolicy\n );\n\n return useMemo(\n () => createPasswordValidator(passwordValidatorPolicy),\n [passwordValidatorPolicy]\n );\n}\n"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,uBAAuB;AAC3D,SAASC,OAAO,QAAQ,OAAO;AAC/B,SAASC,uBAAuB;AAEhC,OAAO,SAASC,oBAAoBA,CAAA,EAAG;EACnC,IAAIC,0BAA0B;EAC9B,IAAI;IACAA,0BAA0B,GAAGC,IAAI,CAACC,KAAK,CACnCC,OAAO,CAACC,GAAG,CAACC,mCAChB,CAAC;EACL,CAAC,CAAC,MAAM;IACJ;EAAA;EAGJ,MAAMC,uBAAuB,GAAGV,SAAS,CAACW,MAAM,CAC5C,2BAA2B,EAC3BP,0BACJ,CAAC;EAED,OAAOH,OAAO,CACV,MAAMC,uBAAuB,CAACQ,uBAAuB,CAAC,EACtD,CAACA,uBAAuB,CAC5B,CAAC;AACL","ignoreList":[]}
|