@webiny/cognito 6.3.0 → 6.4.0-beta.1
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.js +23 -24
- package/Cognito.js.map +1 -1
- package/admin/Cognito.js +35 -41
- package/admin/Cognito.js.map +1 -1
- package/admin/CognitoLogin.js +8 -13
- package/admin/CognitoLogin.js.map +1 -1
- package/admin/Extension.js +17 -16
- package/admin/Extension.js.map +1 -1
- package/admin/SecurityPermission.js +11 -14
- package/admin/SecurityPermission.js.map +1 -1
- package/admin/domain/permissionsSchema.js +14 -9
- package/admin/domain/permissionsSchema.js.map +1 -1
- package/admin/features/permissions/abstractions.js +2 -1
- package/admin/features/permissions/abstractions.js.map +1 -1
- package/admin/features/permissions/feature.js +2 -1
- package/admin/features/permissions/feature.js.map +1 -1
- package/admin/federatedIdentityProviders.js +7 -6
- package/admin/federatedIdentityProviders.js.map +1 -1
- package/admin/presentation/Cognito/CognitoLoginScreen.js +39 -42
- package/admin/presentation/Cognito/CognitoLoginScreen.js.map +1 -1
- package/admin/presentation/Cognito/CognitoPresenter.js +250 -275
- package/admin/presentation/Cognito/CognitoPresenter.js.map +1 -1
- package/admin/presentation/Cognito/abstractions.js +2 -1
- package/admin/presentation/Cognito/abstractions.js.map +1 -1
- package/admin/presentation/Cognito/components/Divider.js +12 -13
- package/admin/presentation/Cognito/components/Divider.js.map +1 -1
- package/admin/presentation/Cognito/components/FederatedLogin.js +24 -29
- package/admin/presentation/Cognito/components/FederatedLogin.js.map +1 -1
- package/admin/presentation/Cognito/components/FederatedProviders.js +7 -10
- package/admin/presentation/Cognito/components/FederatedProviders.js.map +1 -1
- package/admin/presentation/Cognito/components/FooterSignIn.js +9 -12
- package/admin/presentation/Cognito/components/FooterSignIn.js.map +1 -1
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js +33 -37
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js.map +1 -1
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js +35 -39
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js.map +1 -1
- package/admin/presentation/Cognito/components/RequireNewPassword.js +44 -48
- package/admin/presentation/Cognito/components/RequireNewPassword.js.map +1 -1
- package/admin/presentation/Cognito/components/SetNewPassword.js +70 -71
- package/admin/presentation/Cognito/components/SetNewPassword.js.map +1 -1
- package/admin/presentation/Cognito/components/SignIn.js +52 -59
- package/admin/presentation/Cognito/components/SignIn.js.map +1 -1
- package/admin/presentation/Cognito/components/View.js +41 -60
- package/admin/presentation/Cognito/components/View.js.map +1 -1
- package/admin/presentation/Cognito/feature.js +12 -11
- package/admin/presentation/Cognito/feature.js.map +1 -1
- package/admin/presentation/shared/createPasswordValidator.js +13 -24
- package/admin/presentation/shared/createPasswordValidator.js.map +1 -1
- package/admin/presentation/shared/usePasswordValidator.js +11 -10
- package/admin/presentation/shared/usePasswordValidator.js.map +1 -1
- package/admin/presentation/userMenu/AccountDetails.js +15 -18
- package/admin/presentation/userMenu/AccountDetails.js.map +1 -1
- package/admin/presentation/userMenu/useIsDefaultTenant.js +5 -11
- package/admin/presentation/userMenu/useIsDefaultTenant.js.map +1 -1
- package/admin/routes.js +16 -17
- package/admin/routes.js.map +1 -1
- package/admin/ui/UserItem.js +0 -3
- package/admin/ui/components/AvatarImage/AvatarImage.js +25 -37
- package/admin/ui/components/AvatarImage/AvatarImage.js.map +1 -1
- package/admin/ui/components/AvatarImage/AvatarImagePreview.js +49 -51
- package/admin/ui/components/AvatarImage/AvatarImagePreview.js.map +1 -1
- package/admin/ui/components/AvatarImage/AvatarImageTrigger.js +25 -26
- package/admin/ui/components/AvatarImage/AvatarImageTrigger.js.map +1 -1
- package/admin/ui/components/AvatarImage/index.js +0 -2
- package/admin/ui/views/Account/Account.js +117 -130
- package/admin/ui/views/Account/Account.js.map +1 -1
- package/admin/ui/views/Account/graphql.js +5 -4
- package/admin/ui/views/Account/graphql.js.map +1 -1
- package/admin/ui/views/Account/index.js +0 -2
- package/admin/ui/views/Users/UsersDataList.js +146 -159
- package/admin/ui/views/Users/UsersDataList.js.map +1 -1
- package/admin/ui/views/Users/UsersForm.js +151 -162
- package/admin/ui/views/Users/UsersForm.js.map +1 -1
- package/admin/ui/views/Users/UsersView.js +9 -9
- package/admin/ui/views/Users/UsersView.js.map +1 -1
- package/admin/ui/views/Users/components/DeleteAction.js +23 -30
- package/admin/ui/views/Users/components/DeleteAction.js.map +1 -1
- package/admin/ui/views/Users/graphql.js +9 -10
- package/admin/ui/views/Users/graphql.js.map +1 -1
- package/admin/ui/views/Users/hooks/useUserForm.js +104 -114
- package/admin/ui/views/Users/hooks/useUserForm.js.map +1 -1
- package/admin/ui/views/Users/search.js +21 -0
- package/admin/ui/views/Users/search.js.map +1 -0
- package/admin/ui/views/utils.js +9 -7
- package/admin/ui/views/utils.js.map +1 -1
- package/api/CognitoApiFeature.js +15 -17
- package/api/CognitoApiFeature.js.map +1 -1
- package/api/domain/Username.js +5 -4
- package/api/domain/Username.js.map +1 -1
- package/api/domain/errors.js +37 -56
- package/api/domain/errors.js.map +1 -1
- package/api/features/CognitoIdp/CognitoIdentityProvider.js +49 -51
- package/api/features/CognitoIdp/CognitoIdentityProvider.js.map +1 -1
- package/api/features/CognitoIdp/abstractions.js +2 -1
- package/api/features/CognitoIdp/abstractions.js.map +1 -1
- package/api/features/CognitoIdp/feature.js +6 -5
- package/api/features/CognitoIdp/feature.js.map +1 -1
- package/api/features/CognitoIdp/index.js +0 -2
- package/api/features/CognitoService/CognitoService.js +93 -83
- package/api/features/CognitoService/CognitoService.js.map +1 -1
- package/api/features/CognitoService/abstractions.js +3 -5
- package/api/features/CognitoService/abstractions.js.map +1 -1
- package/api/features/CognitoService/feature.js +7 -6
- package/api/features/CognitoService/feature.js.map +1 -1
- package/api/features/CognitoService/index.js +0 -2
- package/api/features/CreateUser/CreateUserUseCase.js +62 -88
- package/api/features/CreateUser/CreateUserUseCase.js.map +1 -1
- package/api/features/CreateUser/abstractions.js +2 -1
- package/api/features/CreateUser/abstractions.js.map +1 -1
- package/api/features/CreateUser/feature.js +6 -5
- package/api/features/CreateUser/feature.js.map +1 -1
- package/api/features/CreateUser/index.js +0 -2
- package/api/features/CreateUser/schema.js +14 -13
- package/api/features/CreateUser/schema.js.map +1 -1
- package/api/features/DeleteUser/DeleteUserUseCase.js +34 -41
- package/api/features/DeleteUser/DeleteUserUseCase.js.map +1 -1
- package/api/features/DeleteUser/abstractions.js +2 -1
- package/api/features/DeleteUser/abstractions.js.map +1 -1
- package/api/features/DeleteUser/feature.js +6 -5
- package/api/features/DeleteUser/feature.js.map +1 -1
- package/api/features/DeleteUser/index.js +0 -2
- package/api/features/UpdateUser/UpdateUserUseCase.js +49 -71
- package/api/features/UpdateUser/UpdateUserUseCase.js.map +1 -1
- package/api/features/UpdateUser/abstractions.js +2 -1
- package/api/features/UpdateUser/abstractions.js.map +1 -1
- package/api/features/UpdateUser/feature.js +6 -5
- package/api/features/UpdateUser/feature.js.map +1 -1
- package/api/features/UpdateUser/index.js +0 -2
- package/api/features/UpdateUser/schema.js +13 -12
- package/api/features/UpdateUser/schema.js.map +1 -1
- package/api/features/UserInstaller/UserInstaller.js +36 -36
- package/api/features/UserInstaller/UserInstaller.js.map +1 -1
- package/api/features/UserInstaller/feature.js +6 -5
- package/api/features/UserInstaller/feature.js.map +1 -1
- package/api/graphql/user.gql.js +83 -107
- package/api/graphql/user.gql.js.map +1 -1
- package/index.js +0 -2
- package/package.json +23 -24
- package/static/svg/search.43fa797c.svg +20 -0
- package/admin/ui/UserItem.js.map +0 -1
- package/admin/ui/components/AvatarImage/index.js.map +0 -1
- package/admin/ui/views/Account/index.js.map +0 -1
- package/api/features/CognitoIdp/index.js.map +0 -1
- package/api/features/CognitoService/index.js.map +0 -1
- package/api/features/CreateUser/index.js.map +0 -1
- package/api/features/DeleteUser/index.js.map +0 -1
- package/api/features/UpdateUser/index.js.map +0 -1
- package/index.js.map +0 -1
|
@@ -1,79 +1,78 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Button, Grid, Input
|
|
3
|
-
import {
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { Alert, Button, Grid, Input } from "@webiny/admin-ui";
|
|
3
|
+
import { Bind, Form, useForm } from "@webiny/form";
|
|
4
4
|
import { validation } from "@webiny/validation";
|
|
5
5
|
import { View } from "./View.js";
|
|
6
6
|
import { FooterSignIn } from "./FooterSignIn.js";
|
|
7
7
|
import { usePasswordValidator } from "../../shared/usePasswordValidator.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
containerClassName: "ml-auto",
|
|
58
|
-
disabled: vm.isLoading
|
|
59
|
-
})))))));
|
|
8
|
+
const SetNewPassword = (props)=>{
|
|
9
|
+
const { vm, onSetNewPassword, onCancel } = props;
|
|
10
|
+
const passwordValidator = usePasswordValidator();
|
|
11
|
+
return /*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(Form, {
|
|
12
|
+
onSubmit: (data)=>onSetNewPassword(data.code, data.password),
|
|
13
|
+
submitOnEnter: true
|
|
14
|
+
}, ({ submit })=>/*#__PURE__*/ react.createElement(View.Content, null, /*#__PURE__*/ react.createElement(View.Title, {
|
|
15
|
+
title: "Set new password"
|
|
16
|
+
}), vm.message && /*#__PURE__*/ react.createElement("div", {
|
|
17
|
+
className: "mb-lg"
|
|
18
|
+
}, /*#__PURE__*/ react.createElement(Alert, {
|
|
19
|
+
title: vm.message.title,
|
|
20
|
+
type: vm.message.type
|
|
21
|
+
}, vm.message.text)), /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
22
|
+
span: 12
|
|
23
|
+
}, /*#__PURE__*/ react.createElement(Bind, {
|
|
24
|
+
name: "code",
|
|
25
|
+
validators: validation.create("required")
|
|
26
|
+
}, /*#__PURE__*/ react.createElement(Input, {
|
|
27
|
+
label: "Verification Code",
|
|
28
|
+
description: "Enter the code we sent to your email.",
|
|
29
|
+
autoComplete: "new-password"
|
|
30
|
+
}))), /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
31
|
+
span: 12
|
|
32
|
+
}, /*#__PURE__*/ react.createElement(Bind, {
|
|
33
|
+
name: "password",
|
|
34
|
+
validators: [
|
|
35
|
+
validation.create("required"),
|
|
36
|
+
passwordValidator
|
|
37
|
+
]
|
|
38
|
+
}, /*#__PURE__*/ react.createElement(Input, {
|
|
39
|
+
type: "password",
|
|
40
|
+
label: "New Password",
|
|
41
|
+
description: "Enter your new password.",
|
|
42
|
+
autoComplete: "new-password"
|
|
43
|
+
}))), /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
44
|
+
span: 12
|
|
45
|
+
}, /*#__PURE__*/ react.createElement(RetypePassword, null)), /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
46
|
+
span: 12
|
|
47
|
+
}, /*#__PURE__*/ react.createElement("div", {
|
|
48
|
+
className: "flex items-center justify-between"
|
|
49
|
+
}, /*#__PURE__*/ react.createElement(FooterSignIn, {
|
|
50
|
+
onSignIn: onCancel
|
|
51
|
+
}), /*#__PURE__*/ react.createElement(Button, {
|
|
52
|
+
text: "Reset Password",
|
|
53
|
+
onClick: submit,
|
|
54
|
+
containerClassName: "ml-auto",
|
|
55
|
+
disabled: vm.isLoading
|
|
56
|
+
})))))));
|
|
60
57
|
};
|
|
61
|
-
const RetypePassword = ()
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
const RetypePassword = ()=>{
|
|
59
|
+
const form = useForm();
|
|
60
|
+
const matchOriginalValidator = (value)=>{
|
|
61
|
+
if (value !== form.getValue("password")) throw Error("Passwords do not match.");
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/ react.createElement(Bind, {
|
|
64
|
+
name: "confirmPassword",
|
|
65
|
+
validators: [
|
|
66
|
+
validation.create("required"),
|
|
67
|
+
matchOriginalValidator
|
|
68
|
+
]
|
|
69
|
+
}, /*#__PURE__*/ react.createElement(Input, {
|
|
70
|
+
type: "password",
|
|
71
|
+
label: "Retype Password",
|
|
72
|
+
description: "Enter your new password once more.",
|
|
73
|
+
autoComplete: "new-password"
|
|
74
|
+
}));
|
|
77
75
|
};
|
|
76
|
+
export { SetNewPassword };
|
|
78
77
|
|
|
79
78
|
//# sourceMappingURL=SetNewPassword.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/components/SetNewPassword.js","sources":["../../../../../src/admin/presentation/Cognito/components/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"],"names":["SetNewPassword","props","vm","onSetNewPassword","onCancel","passwordValidator","usePasswordValidator","View","Form","data","submit","Alert","Grid","Bind","validation","Input","RetypePassword","FooterSignIn","Button","form","useForm","matchOriginalValidator","value","Error"],"mappings":";;;;;;;AAeO,MAAMA,iBAAiB,CAACC;IAC3B,MAAM,EAAEC,EAAE,EAAEC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGH;IAC3C,MAAMI,oBAAoBC;IAE1B,OAAO,WAAP,GACI,oBAACC,KAAK,SAAS,sBACX,oBAACC,MAAIA;QACD,UAAU,CAACC,OAAcN,iBAAiBM,KAAK,IAAI,EAAEA,KAAK,QAAQ;QAClE;OAEC,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,sBACT,oBAACA,KAAK,KAAK;YAAC,OAAO;YAElBL,GAAG,OAAO,IAAI,WAAJ,GACP,oBAAC;YAAI,WAAW;yBACZ,oBAACS,OAAKA;YAAC,OAAOT,GAAG,OAAO,CAAC,KAAK;YAAE,MAAMA,GAAG,OAAO,CAAC,IAAI;WAChDA,GAAG,OAAO,CAAC,IAAI,kBAK5B,oBAACU,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YAAC,MAAK;YAAO,YAAYC,WAAW,MAAM,CAAC;yBAC5C,oBAACC,OAAKA;YACF,OAAO;YACP,aAAa;YACb,cAAc;4BAI1B,oBAACH,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YACD,MAAK;YACL,YAAY;gBAACC,WAAW,MAAM,CAAC;gBAAaT;aAAkB;yBAE9D,oBAACU,OAAKA;YACF,MAAM;YACN,OAAO;YACP,aAAa;YACb,cAAc;4BAI1B,oBAACH,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACI,gBAAcA,QAAAA,WAAAA,GAEnB,oBAACJ,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YAAI,WAAW;yBACZ,oBAACK,cAAYA;YAAC,UAAUb;0BACxB,oBAACc,QAAMA;YACH,MAAM;YACN,SAASR;YACT,oBAAoB;YACpB,UAAUR,GAAG,SAAS;;AAU9D;AAEA,MAAMc,iBAAiB;IACnB,MAAMG,OAAOC;IACb,MAAMC,yBAAyB,CAACC;QAC5B,IAAIA,UAAUH,KAAK,QAAQ,CAAC,aACxB,MAAMI,MAAM;IAEpB;IAEA,OAAO,WAAP,GACI,oBAACV,MAAIA;QACD,MAAK;QACL,YAAY;YAACC,WAAW,MAAM,CAAC;YAAaO;SAAuB;qBAEnE,oBAACN,OAAKA;QACF,MAAM;QACN,OAAO;QACP,aAAa;QACb,cAAc;;AAI9B"}
|
|
@@ -1,64 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Grid, Input,
|
|
3
|
-
import {
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { Alert, Button, Grid, Input, Link, OverlayLoader, Text } from "@webiny/admin-ui";
|
|
3
|
+
import { Bind, Form } from "@webiny/form";
|
|
4
4
|
import { validation } from "@webiny/validation";
|
|
5
5
|
import { View } from "./View.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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?"))))))));
|
|
6
|
+
const SignIn = (props)=>{
|
|
7
|
+
const { vm, onSubmit, onForgotPassword, title = "Sign in", description } = props;
|
|
8
|
+
return /*#__PURE__*/ react.createElement(View.Container, null, /*#__PURE__*/ react.createElement(Form, {
|
|
9
|
+
onSubmit: (data)=>onSubmit(data.username, data.password),
|
|
10
|
+
submitOnEnter: true
|
|
11
|
+
}, ({ submit })=>/*#__PURE__*/ react.createElement(View.Content, null, vm.isLoading ? /*#__PURE__*/ react.createElement(OverlayLoader, {
|
|
12
|
+
text: "Authenticating..."
|
|
13
|
+
}) : null, /*#__PURE__*/ react.createElement(View.Title, {
|
|
14
|
+
title: title,
|
|
15
|
+
description: description
|
|
16
|
+
}), vm.message && /*#__PURE__*/ react.createElement("div", {
|
|
17
|
+
className: "mb-lg"
|
|
18
|
+
}, /*#__PURE__*/ react.createElement(Alert, {
|
|
19
|
+
title: vm.message.title,
|
|
20
|
+
type: vm.message.type
|
|
21
|
+
}, vm.message.text)), /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
22
|
+
span: 12
|
|
23
|
+
}, /*#__PURE__*/ react.createElement(Bind, {
|
|
24
|
+
name: "username",
|
|
25
|
+
validators: validation.create("required,email"),
|
|
26
|
+
beforeChange: (val, cb)=>cb(val.toLowerCase())
|
|
27
|
+
}, /*#__PURE__*/ react.createElement(Input, {
|
|
28
|
+
label: "Email"
|
|
29
|
+
}))), /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
30
|
+
span: 12
|
|
31
|
+
}, /*#__PURE__*/ react.createElement(Bind, {
|
|
32
|
+
name: "password",
|
|
33
|
+
validators: validation.create("required")
|
|
34
|
+
}, /*#__PURE__*/ react.createElement(Input, {
|
|
35
|
+
type: "password",
|
|
36
|
+
label: "Password",
|
|
37
|
+
autoComplete: "off"
|
|
38
|
+
}))), /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
39
|
+
span: 12
|
|
40
|
+
}, /*#__PURE__*/ react.createElement("div", {
|
|
41
|
+
className: "flex flex-row-reverse items-center justify-between"
|
|
42
|
+
}, /*#__PURE__*/ react.createElement(Button, {
|
|
43
|
+
text: "Submit",
|
|
44
|
+
"data-testid": "submit-sign-in-form-button",
|
|
45
|
+
onClick: submit,
|
|
46
|
+
disabled: vm.isLoading
|
|
47
|
+
}), /*#__PURE__*/ react.createElement(Text, {
|
|
48
|
+
as: "div",
|
|
49
|
+
size: "sm"
|
|
50
|
+
}, /*#__PURE__*/ react.createElement(Link, {
|
|
51
|
+
to: "#",
|
|
52
|
+
onClick: onForgotPassword
|
|
53
|
+
}, "Forgot password?"))))))));
|
|
62
54
|
};
|
|
55
|
+
export { SignIn };
|
|
63
56
|
|
|
64
57
|
//# sourceMappingURL=SignIn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/components/SignIn.js","sources":["../../../../../src/admin/presentation/Cognito/components/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"],"names":["SignIn","props","vm","onSubmit","onForgotPassword","title","description","View","Form","data","submit","OverlayLoader","Alert","Grid","Bind","validation","val","cb","Input","Button","Text","Link"],"mappings":";;;;;AAeO,MAAMA,SAAS,CAACC;IACnB,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAEC,gBAAgB,EAAEC,QAAQ,SAAS,EAAEC,WAAW,EAAE,GAAGL;IAE3E,OAAO,WAAP,GACI,oBAACM,KAAK,SAAS,sBACX,oBAACC,MAAIA;QAAC,UAAU,CAACC,OAAcN,SAASM,KAAK,QAAQ,EAAEA,KAAK,QAAQ;QAAG;OAClE,CAAC,EAAEC,MAAM,EAAE,iBACR,oBAACH,KAAK,OAAO,QACRL,GAAG,SAAS,GAAG,WAAH,GAAG,oBAACS,eAAaA;YAAC,MAAM;aAA0B,oBAC/D,oBAACJ,KAAK,KAAK;YAAC,OAAOF;YAAO,aAAaC;YAEtCJ,GAAG,OAAO,IAAI,WAAJ,GACP,oBAAC;YAAI,WAAW;yBACZ,oBAACU,OAAKA;YAAC,OAAOV,GAAG,OAAO,CAAC,KAAK;YAAE,MAAMA,GAAG,OAAO,CAAC,IAAI;WAChDA,GAAG,OAAO,CAAC,IAAI,kBAK5B,oBAACW,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YACD,MAAK;YACL,YAAYC,WAAW,MAAM,CAAC;YAC9B,cAAc,CAACC,KAAaC,KACxBA,GAAGD,IAAI,WAAW;yBAGtB,oBAACE,OAAKA;YAAC,OAAO;4BAGtB,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACC,MAAIA;YAAC,MAAK;YAAW,YAAYC,WAAW,MAAM,CAAC;yBAChD,oBAACG,OAAKA;YACF,MAAM;YACN,OAAO;YACP,cAAc;4BAI1B,oBAACL,KAAK,MAAM;YAAC,MAAM;yBACf,oBAAC;YACG,WAAW;yBAEX,oBAACM,QAAMA;YACH,MAAM;YACN,eAAY;YACZ,SAAST;YACT,UAAUR,GAAG,SAAS;0BAE1B,oBAACkB,MAAIA;YAAC,IAAI;YAAO,MAAM;yBACnB,oBAACC,MAAIA;YAAC,IAAG;YAAI,SAASjB;WAAkB;AAYhF"}
|
|
@@ -1,67 +1,48 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import capitalize from "lodash/capitalize";
|
|
3
2
|
import { Logo, makeDecoratable } from "@webiny/app-admin";
|
|
4
3
|
import { Alert, Grid, Heading, Text } from "@webiny/admin-ui";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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));
|
|
4
|
+
import * as __rspack_external_react from "react";
|
|
5
|
+
const Container = makeDecoratable("ViewContainer", ({ children })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
6
|
+
className: "w-full h-screen bg-neutral-light flex-1"
|
|
7
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement("section", {
|
|
8
|
+
className: "m-auto flex flex-col justify-center min-h-screen"
|
|
9
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
10
|
+
className: "mx-auto"
|
|
11
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(Logo, null)), /*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
12
|
+
className: "w-full max-w-[480px] mx-auto my-lg"
|
|
13
|
+
}, children))));
|
|
14
|
+
const Content = makeDecoratable("ViewContent", ({ children })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
15
|
+
className: "relative p-lg pt-md bg-neutral-base rounded-xl"
|
|
16
|
+
}, children));
|
|
17
|
+
const Footer = makeDecoratable("ViewFooter", ({ children })=>/*#__PURE__*/ __rspack_external_react.createElement(Grid, null, /*#__PURE__*/ __rspack_external_react.createElement(Grid.Column, {
|
|
18
|
+
span: 12,
|
|
19
|
+
className: "text-center mt-lg"
|
|
20
|
+
}, children)));
|
|
21
|
+
const Title = makeDecoratable("ViewTitle", ({ title, description })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
22
|
+
className: "mb-md"
|
|
23
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(Heading, {
|
|
24
|
+
level: 4
|
|
25
|
+
}, capitalize(title)), description && /*#__PURE__*/ __rspack_external_react.createElement(Text, {
|
|
26
|
+
as: "div",
|
|
27
|
+
size: "sm",
|
|
28
|
+
className: "text-neutral-strong"
|
|
29
|
+
}, description)));
|
|
30
|
+
const Error = ({ title = "Something went wrong", description })=>{
|
|
31
|
+
if (!description) return null;
|
|
32
|
+
return /*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
33
|
+
className: "mb-lg"
|
|
34
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(Alert, {
|
|
35
|
+
title: title,
|
|
36
|
+
type: "danger"
|
|
37
|
+
}, description));
|
|
58
38
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
39
|
+
const View = {
|
|
40
|
+
Container: Container,
|
|
41
|
+
Content: Content,
|
|
42
|
+
Title: Title,
|
|
43
|
+
Footer: Footer,
|
|
44
|
+
Error: Error
|
|
65
45
|
};
|
|
46
|
+
export { Error, View };
|
|
66
47
|
|
|
67
48
|
//# sourceMappingURL=View.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/components/View.js","sources":["../../../../../src/admin/presentation/Cognito/components/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"],"names":["Container","makeDecoratable","children","Logo","Content","Footer","Grid","Title","title","description","Heading","capitalize","Text","Error","Alert","View"],"mappings":";;;;AASA,MAAMA,YAAYC,gBAAgB,iBAAiB,CAAC,EAAEC,QAAQ,EAAkB,GACrE,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAAC;QAAQ,WAAW;qBAChB,sCAAC;QAAI,WAAW;qBACZ,sCAACC,MAAIA,QAAAA,WAAAA,GAET,sCAAC;QAAI,WAAW;OAAuCD;AAUvE,MAAME,UAAUH,gBAAgB,eAAe,CAAC,EAAEC,QAAQ,EAAgB,iBACtE,sCAAC;QAAI,WAAW;OAAmDA;AAOvE,MAAMG,SAASJ,gBAAgB,cAAc,CAAC,EAAEC,QAAQ,EAAe,GAC5D,WAAP,GACI,sCAACI,MAAIA,MAAAA,WAAAA,GACD,sCAACA,KAAK,MAAM;QAAC,MAAM;QAAI,WAAW;OAC7BJ;AAWjB,MAAMK,QAAQN,gBAAgB,aAAa,CAAC,EAAEO,KAAK,EAAEC,WAAW,EAAc,GACnE,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACC,SAAOA;QAAC,OAAO;OAAIC,WAAWH,SAC9BC,eAAe,WAAfA,GACG,sCAACG,MAAIA;QAAC,IAAI;QAAO,MAAM;QAAM,WAAW;OACnCH;AAYd,MAAMI,QAAQ,CAAC,EAAEL,QAAQ,sBAAsB,EAAEC,WAAW,EAAc;IAC7E,IAAI,CAACA,aACD,OAAO;IAGX,OAAO,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACK,OAAKA;QAAC,OAAON;QAAO,MAAM;OACtBC;AAIjB;AAEO,MAAMM,OAAO;IAChBf,WAAAA;IACAI,SAAAA;IACAG,OAAAA;IACAF,QAAAA;IACAQ,OAAAA;AACJ"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/admin";
|
|
2
2
|
import { CognitoPresenter } from "./CognitoPresenter.js";
|
|
3
|
-
import { CognitoPresenter as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
import { CognitoPresenter as external_abstractions_js_CognitoPresenter } from "./abstractions.js";
|
|
4
|
+
const CognitoFeature = createFeature({
|
|
5
|
+
name: "Cognito",
|
|
6
|
+
register (container) {
|
|
7
|
+
container.register(CognitoPresenter).inSingletonScope();
|
|
8
|
+
},
|
|
9
|
+
resolve (container) {
|
|
10
|
+
return {
|
|
11
|
+
presenter: container.resolve(external_abstractions_js_CognitoPresenter)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
14
|
});
|
|
15
|
+
export { CognitoFeature };
|
|
15
16
|
|
|
16
17
|
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/presentation/Cognito/feature.js","sources":["../../../../src/admin/presentation/Cognito/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"],"names":["CognitoFeature","createFeature","container","CognitoPresenter","Presenter"],"mappings":";;;AAIO,MAAMA,iBAAiBC,cAAc;IACxC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,kBAAkB,gBAAgB;IACzD;IACA,SAAQD,SAAS;QACb,OAAO;YACH,WAAWA,UAAU,OAAO,CAACE;QACjC;IACJ;AACJ"}
|
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
import { ValidationError } from "@webiny/validation";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
};
|
|
2
|
+
const createPasswordValidator = (policy)=>(value)=>{
|
|
3
|
+
if (!value) return;
|
|
4
|
+
const requireSymbols = /([=+\-^$*.[\]{}()?"!@#%&/,><':;|_~`])+/;
|
|
5
|
+
const requireNumber = /[0-9]/;
|
|
6
|
+
const requireLowercase = /[a-z]/;
|
|
7
|
+
const requireUppercase = /[A-Z]/;
|
|
8
|
+
if (void 0 !== policy.minimumLength && value.length < policy.minimumLength) throw new ValidationError(`Value requires at least ${policy.minimumLength} characters.`);
|
|
9
|
+
if (policy.requireLowercase && !requireLowercase.test(value)) throw new ValidationError("Value must contain a lowercase character.");
|
|
10
|
+
if (policy.requireNumbers && !requireNumber.test(value)) throw new ValidationError("Value must contain a number.");
|
|
11
|
+
if (policy.requireUppercase && !requireUppercase.test(value)) throw new ValidationError("Value must contain an uppercase character.");
|
|
12
|
+
if (policy.requireSymbols && !requireSymbols.test(value)) throw new ValidationError("Value must contain a special character.");
|
|
13
|
+
};
|
|
14
|
+
export { createPasswordValidator };
|
|
26
15
|
|
|
27
16
|
//# sourceMappingURL=createPasswordValidator.js.map
|