@webiny/app-admin-cognito 0.0.0-mt-3 → 0.0.0-unstable.06b2ede40f
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/components/Divider.d.ts +2 -0
- package/components/Divider.js +16 -0
- package/components/Divider.js.map +1 -0
- package/components/FederatedProviders.d.ts +44 -0
- package/components/FederatedProviders.js +14 -0
- package/components/FederatedProviders.js.map +1 -0
- package/components/View.d.ts +98 -0
- package/components/View.js +66 -0
- package/components/View.js.map +1 -0
- package/federatedIdentityProviders.d.ts +9 -0
- package/federatedIdentityProviders.js +9 -0
- package/federatedIdentityProviders.js.map +1 -0
- package/index.d.ts +136 -8
- package/index.js +130 -150
- package/index.js.map +1 -0
- package/package.json +22 -29
- package/types.js +3 -0
- package/types.js.map +1 -0
- package/views/FederatedLogin.d.ts +7 -0
- package/views/FederatedLogin.js +32 -0
- package/views/FederatedLogin.js.map +1 -0
- package/views/ForgotPassword.d.ts +2 -3
- package/views/ForgotPassword.js +91 -98
- package/views/ForgotPassword.js.map +1 -0
- package/views/LoggingIn.d.ts +2 -0
- package/views/LoggingIn.js +9 -0
- package/views/LoggingIn.js.map +1 -0
- package/views/RequireNewPassword.d.ts +2 -3
- package/views/RequireNewPassword.js +61 -70
- package/views/RequireNewPassword.js.map +1 -0
- package/views/SetNewPassword.d.ts +2 -3
- package/views/SetNewPassword.js +56 -63
- package/views/SetNewPassword.js.map +1 -0
- package/views/SignIn.d.ts +36 -3
- package/views/SignIn.js +94 -82
- package/views/SignIn.js.map +1 -0
- package/views/SignedIn.d.ts +6 -4
- package/views/SignedIn.js +7 -8
- package/views/SignedIn.js.map +1 -0
- package/views/CheckingUser.d.ts +0 -3
- package/views/CheckingUser.js +0 -14
- package/views/StateContainer.d.ts +0 -5
- package/views/StateContainer.js +0 -12
- package/views/StyledComponents.d.ts +0 -10
- package/views/StyledComponents.js +0 -74
- package/views/webiny-orange-logo.svg +0 -23
package/views/ForgotPassword.js
CHANGED
|
@@ -1,111 +1,104 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { Alert, Button, Grid, Input, Label, Link, OverlayLoader, Text } from "@webiny/admin-ui";
|
|
2
3
|
import { Form } from "@webiny/form";
|
|
3
4
|
import { validation } from "@webiny/validation";
|
|
4
|
-
import { ButtonPrimary, ButtonDefault } from "@webiny/ui/Button";
|
|
5
|
-
import { Input } from "@webiny/ui/Input";
|
|
6
|
-
import { Grid, Cell } from "@webiny/ui/Grid";
|
|
7
|
-
import { Typography } from "@webiny/ui/Typography";
|
|
8
|
-
import { Alert } from "@webiny/ui/Alert";
|
|
9
|
-
import { Elevation } from "@webiny/ui/Elevation";
|
|
10
|
-
import StateContainer from "./StateContainer";
|
|
11
|
-
import { alignRight, InnerContent, Title } from "./StyledComponents";
|
|
12
|
-
import { CircularProgress } from "@webiny/ui/Progress";
|
|
13
5
|
import { useAuthenticator } from "@webiny/app-cognito-authenticator/hooks/useAuthenticator";
|
|
14
6
|
import { useForgotPassword } from "@webiny/app-cognito-authenticator/hooks/useForgotPassword";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!shouldRender || checkingUser) {
|
|
7
|
+
import { View } from "../components/View";
|
|
8
|
+
export const ForgotPassword = () => {
|
|
9
|
+
const {
|
|
10
|
+
authData,
|
|
11
|
+
changeState
|
|
12
|
+
} = useAuthenticator();
|
|
13
|
+
const {
|
|
14
|
+
loading,
|
|
15
|
+
codeSent,
|
|
16
|
+
shouldRender,
|
|
17
|
+
setPassword,
|
|
18
|
+
requestCode,
|
|
19
|
+
error
|
|
20
|
+
} = useForgotPassword();
|
|
21
|
+
if (!shouldRender) {
|
|
31
22
|
return null;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return /*#__PURE__*/React.createElement(StateContainer, null, /*#__PURE__*/React.createElement(Form, {
|
|
24
|
+
const {
|
|
25
|
+
username = ""
|
|
26
|
+
} = authData || {};
|
|
27
|
+
return /*#__PURE__*/React.createElement(View.Container, null, /*#__PURE__*/React.createElement(Form, {
|
|
39
28
|
data: {
|
|
40
|
-
username
|
|
29
|
+
username
|
|
41
30
|
},
|
|
42
|
-
onSubmit:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
onSubmit: ({
|
|
32
|
+
username
|
|
33
|
+
}) => codeSent ? setPassword({
|
|
34
|
+
username
|
|
35
|
+
}) : requestCode({
|
|
36
|
+
username
|
|
37
|
+
}),
|
|
38
|
+
submitOnEnter: true
|
|
39
|
+
}, ({
|
|
40
|
+
Bind,
|
|
41
|
+
submit,
|
|
42
|
+
data
|
|
43
|
+
}) => /*#__PURE__*/React.createElement(View.Content, null, loading && /*#__PURE__*/React.createElement(OverlayLoader, null), /*#__PURE__*/React.createElement(View.Title, {
|
|
44
|
+
title: "Password recovery",
|
|
45
|
+
description: "Request a password reset code."
|
|
46
|
+
}), error && /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: "wby-mb-lg"
|
|
48
|
+
}, /*#__PURE__*/React.createElement(Alert, {
|
|
49
|
+
title: "Something went wrong",
|
|
50
|
+
type: "danger"
|
|
51
|
+
}, error)), !codeSent ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
52
|
+
span: 12
|
|
53
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
54
|
+
name: "username",
|
|
55
|
+
validators: validation.create("required"),
|
|
56
|
+
beforeChange: (val, cb) => cb(val.toLowerCase())
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
58
|
+
label: /*#__PURE__*/React.createElement(Label, {
|
|
59
|
+
text: "Email",
|
|
60
|
+
hint: "A reset code will be sent to your email."
|
|
61
|
+
}),
|
|
62
|
+
size: "lg"
|
|
63
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
64
|
+
span: 12
|
|
65
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "wby-flex wby-flex-row-reverse wby-items-center wby-justify-between"
|
|
67
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
68
|
+
text: "Send me the code",
|
|
69
|
+
onClick: ev => {
|
|
70
|
+
submit(ev);
|
|
71
|
+
},
|
|
72
|
+
"data-testid": "send-code",
|
|
73
|
+
size: "lg"
|
|
74
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
75
|
+
as: "div",
|
|
76
|
+
size: "sm"
|
|
77
|
+
}, "Want to sign in?\xA0", /*#__PURE__*/React.createElement(Link, {
|
|
78
|
+
to: "#",
|
|
79
|
+
onClick: () => changeState("signIn")
|
|
80
|
+
}, "Sign in"), "."))))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
81
|
+
span: 12
|
|
82
|
+
}, /*#__PURE__*/React.createElement(Text, null, "We have sent you a code to reset your password!", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), "Click the \"Resend code\" button below to resend the code in case you haven't received it the first time.")), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
83
|
+
span: 12
|
|
84
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: "wby-flex wby-flex-row-reverse wby-justify-start wby-gap-md"
|
|
86
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
87
|
+
text: "I got the code!",
|
|
88
|
+
onClick: ev => {
|
|
89
|
+
submit(ev);
|
|
90
|
+
},
|
|
91
|
+
size: "lg"
|
|
92
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
93
|
+
variant: "secondary",
|
|
94
|
+
text: "Resend code",
|
|
95
|
+
onClick: () => {
|
|
96
|
+
requestCode({
|
|
97
|
+
username: data.username
|
|
48
98
|
});
|
|
49
99
|
},
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
var Bind = _ref3.Bind,
|
|
53
|
-
submit = _ref3.submit,
|
|
54
|
-
data = _ref3.data;
|
|
55
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Elevation, {
|
|
56
|
-
z: 2
|
|
57
|
-
}, /*#__PURE__*/React.createElement(InnerContent, null, loading && /*#__PURE__*/React.createElement(CircularProgress, null), /*#__PURE__*/React.createElement(Title, null, /*#__PURE__*/React.createElement("h1", null, /*#__PURE__*/React.createElement(Typography, {
|
|
58
|
-
use: "headline4"
|
|
59
|
-
}, "Password Recovery")), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(Typography, {
|
|
60
|
-
use: "subtitle2"
|
|
61
|
-
}, "request a password reset code"))), error && /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
62
|
-
span: 12
|
|
63
|
-
}, /*#__PURE__*/React.createElement(Alert, {
|
|
64
|
-
title: "Something went wrong",
|
|
65
|
-
type: "danger"
|
|
66
|
-
}, error))), !codeSent ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
67
|
-
span: 12
|
|
68
|
-
}, /*#__PURE__*/React.createElement(Bind, {
|
|
69
|
-
name: "username",
|
|
70
|
-
validators: validation.create("required"),
|
|
71
|
-
beforeChange: function beforeChange(val, cb) {
|
|
72
|
-
return cb(val.toLowerCase());
|
|
73
|
-
}
|
|
74
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
75
|
-
label: "Email",
|
|
76
|
-
description: "A reset code will be sent to your email."
|
|
77
|
-
})))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
78
|
-
span: 12,
|
|
79
|
-
className: alignRight
|
|
80
|
-
}, /*#__PURE__*/React.createElement(ButtonPrimary, {
|
|
81
|
-
onClick: submit
|
|
82
|
-
}, "Send me the code")))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
83
|
-
span: 12
|
|
84
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
85
|
-
use: "body1"
|
|
86
|
-
}, "We have sent you a code to reset your password!", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), "Click the \"Resend code\" button below to resend the code in case you haven't received it the first time."))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
87
|
-
span: 12,
|
|
88
|
-
className: alignRight
|
|
89
|
-
}, /*#__PURE__*/React.createElement(ButtonDefault, {
|
|
90
|
-
onClick: function onClick() {
|
|
91
|
-
return requestCode({
|
|
92
|
-
username: data.username
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}, "Resend code"), /*#__PURE__*/React.createElement(ButtonPrimary, {
|
|
96
|
-
onClick: submit
|
|
97
|
-
}, "I got the code!")))))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
98
|
-
span: 12,
|
|
99
|
-
style: {
|
|
100
|
-
textAlign: "center"
|
|
101
|
-
}
|
|
102
|
-
}, "Want to sign in? ", /*#__PURE__*/React.createElement("a", {
|
|
103
|
-
href: "#",
|
|
104
|
-
onClick: function onClick() {
|
|
105
|
-
return changeState("signIn");
|
|
106
|
-
}
|
|
107
|
-
}, "Sign in"))));
|
|
108
|
-
}));
|
|
100
|
+
size: "lg"
|
|
101
|
+
}))))))));
|
|
109
102
|
};
|
|
110
103
|
|
|
111
|
-
|
|
104
|
+
//# sourceMappingURL=ForgotPassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Alert","Button","Grid","Input","Label","Link","OverlayLoader","Text","Form","validation","useAuthenticator","useForgotPassword","View","ForgotPassword","authData","changeState","loading","codeSent","shouldRender","setPassword","requestCode","error","username","createElement","Container","data","onSubmit","submitOnEnter","Bind","submit","Content","Title","title","description","className","type","Fragment","Column","span","name","validators","create","beforeChange","val","cb","toLowerCase","label","text","hint","size","onClick","ev","as","to","variant"],"sources":["ForgotPassword.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Alert, Button, Grid, Input, Label, Link, OverlayLoader, Text } from \"@webiny/admin-ui\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport { useForgotPassword } from \"@webiny/app-cognito-authenticator/hooks/useForgotPassword\";\nimport { View } from \"~/components/View\";\n\nexport const ForgotPassword = () => {\n const { authData, changeState } = useAuthenticator();\n const { loading, codeSent, shouldRender, setPassword, requestCode, error } =\n useForgotPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n const { username = \"\" } = authData || {};\n\n return (\n <View.Container>\n <Form\n data={{ username }}\n onSubmit={({ username }) =>\n codeSent ? setPassword({ username }) : requestCode({ username })\n }\n submitOnEnter\n >\n {({ Bind, submit, data }) => (\n <View.Content>\n {loading && <OverlayLoader />}\n <View.Title\n title={\"Password recovery\"}\n description={\"Request a password reset code.\"}\n />\n {error && (\n <div className={\"wby-mb-lg\"}>\n <Alert title={\"Something went wrong\"} type={\"danger\"}>\n {error}\n </Alert>\n </div>\n )}\n\n {!codeSent ? (\n <>\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name=\"username\"\n validators={validation.create(\"required\")}\n beforeChange={(\n val: string,\n cb: (value: string) => void\n ) => cb(val.toLowerCase())}\n >\n <Input\n label={\n <Label\n text={\"Email\"}\n hint={\n \"A reset code will be sent to your email.\"\n }\n />\n }\n size={\"lg\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div\n className={\n \"wby-flex wby-flex-row-reverse wby-items-center wby-justify-between\"\n }\n >\n <Button\n text={\"Send me the code\"}\n onClick={ev => {\n submit(ev);\n }}\n data-testid=\"send-code\"\n size=\"lg\"\n />\n <Text as={\"div\"} size={\"sm\"}>\n Want to sign in? \n <Link\n to={\"#\"}\n onClick={() => changeState(\"signIn\")}\n >\n Sign in\n </Link>\n .\n </Text>\n </div>\n </Grid.Column>\n </Grid>\n </>\n ) : (\n <>\n <Grid>\n <Grid.Column span={12}>\n <Text>\n We have sent you a code to reset your password!\n <br />\n <br />\n Click the "Resend code" button below to resend\n the code in case you haven't received it the first\n time.\n </Text>\n </Grid.Column>\n <Grid.Column span={12}>\n <div\n className={\n \"wby-flex wby-flex-row-reverse wby-justify-start wby-gap-md\"\n }\n >\n <Button\n text={\"I got the code!\"}\n onClick={ev => {\n submit(ev);\n }}\n size=\"lg\"\n />\n <Button\n variant={\"secondary\"}\n text={\"Resend code\"}\n onClick={() => {\n requestCode({ username: data.username });\n }}\n size=\"lg\"\n />\n </div>\n </Grid.Column>\n </Grid>\n </>\n )}\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,EAAEC,aAAa,EAAEC,IAAI,QAAQ,kBAAkB;AAC/F,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,gBAAgB,QAAQ,0DAA0D;AAC3F,SAASC,iBAAiB,QAAQ,2DAA2D;AAC7F,SAASC,IAAI;AAEb,OAAO,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAChC,MAAM;IAAEC,QAAQ;IAAEC;EAAY,CAAC,GAAGL,gBAAgB,CAAC,CAAC;EACpD,MAAM;IAAEM,OAAO;IAAEC,QAAQ;IAAEC,YAAY;IAAEC,WAAW;IAAEC,WAAW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AAAwB,aAAA,WAAK,CAAC,eACNxB,KAAA,CAAAwB,aAAA,WAAK,CAAC,6GAIJ,CACG,CAAC,eACdxB,KAAA,CAAAwB,aAAA,CAACrB,IAAI,CAACmC,MAAM;IAACC,IAAI,EAAE;EAAG,gBAClBvC,KAAA,CAAAwB,aAAA;IACIW,SAAS,EACL;EACH,gBAEDnC,KAAA,CAAAwB,aAAA,CAACtB,MAAM;IACH8C,IAAI,EAAE,iBAAkB;IACxBG,OAAO,EAAEC,EAAE,IAAI;MACXtB,MAAM,CAACsB,EAAE,CAAC;IACd,CAAE;IACFF,IAAI,EAAC;EAAI,CACZ,CAAC,eACFlD,KAAA,CAAAwB,aAAA,CAACtB,MAAM;IACHqD,OAAO,EAAE,WAAY;IACrBP,IAAI,EAAE,aAAc;IACpBG,OAAO,EAAEA,CAAA,KAAM;MACX9B,WAAW,CAAC;QAAEE,QAAQ,EAAEG,IAAI,CAACH;MAAS,CAAC,CAAC;IAC5C,CAAE;IACF2B,IAAI,EAAC;EAAI,CACZ,CACA,CACI,CACX,CACR,CAEI,CAEhB,CACM,CAAC;AAEzB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","OverlayLoader","LoggingIn","createElement","text"],"sources":["LoggingIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { OverlayLoader } from \"@webiny/admin-ui\";\n\nexport const LoggingIn = () => {\n return <OverlayLoader text={\"Loading identity...\"} />;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAQ,kBAAkB;AAEhD,OAAO,MAAMC,SAAS,GAAGA,CAAA,KAAM;EAC3B,oBAAOF,KAAA,CAAAG,aAAA,CAACF,aAAa;IAACG,IAAI,EAAE;EAAsB,CAAE,CAAC;AACzD,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
declare const RequireNewPassword: () => JSX.Element;
|
|
3
|
-
export default RequireNewPassword;
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const RequireNewPassword: () => React.JSX.Element | null;
|
|
@@ -1,80 +1,71 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, Grid, Heading, Input } from "@webiny/admin-ui";
|
|
2
3
|
import { Form } from "@webiny/form";
|
|
3
4
|
import { validation } from "@webiny/validation";
|
|
4
|
-
import { ButtonPrimary } from "@webiny/ui/Button";
|
|
5
|
-
import { Input } from "@webiny/ui/Input";
|
|
6
|
-
import { Grid, Cell } from "@webiny/ui/Grid";
|
|
7
|
-
import { Typography } from "@webiny/ui/Typography";
|
|
8
|
-
import { Elevation } from "@webiny/ui/Elevation";
|
|
9
|
-
import { useAuthenticator } from "@webiny/app-cognito-authenticator/hooks/useAuthenticator";
|
|
10
5
|
import { useRequireNewPassword } from "@webiny/app-cognito-authenticator/hooks/useRequireNewPassword";
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var sentenceCase = function sentenceCase(str) {
|
|
15
|
-
var lower = str.toLowerCase();
|
|
6
|
+
import { View } from "../components/View";
|
|
7
|
+
const sentenceCase = str => {
|
|
8
|
+
const lower = str.toLowerCase();
|
|
16
9
|
return lower[0].toUpperCase() + lower.substring(1);
|
|
17
10
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
requiredAttributes = _useRequireNewPasswor.requiredAttributes,
|
|
26
|
-
confirm = _useRequireNewPasswor.confirm;
|
|
27
|
-
|
|
28
|
-
if (!shouldRender || checkingUser) {
|
|
11
|
+
export const RequireNewPassword = () => {
|
|
12
|
+
const {
|
|
13
|
+
shouldRender,
|
|
14
|
+
requiredAttributes,
|
|
15
|
+
confirm
|
|
16
|
+
} = useRequireNewPassword();
|
|
17
|
+
if (!shouldRender) {
|
|
29
18
|
return null;
|
|
30
19
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
},
|
|
20
|
+
return /*#__PURE__*/React.createElement(View.Container, null, /*#__PURE__*/React.createElement(Form, {
|
|
21
|
+
onSubmit: ({
|
|
22
|
+
password,
|
|
23
|
+
requiredAttributes
|
|
24
|
+
}) => confirm({
|
|
25
|
+
password,
|
|
26
|
+
requiredAttributes
|
|
27
|
+
}),
|
|
41
28
|
submitOnEnter: true
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
29
|
+
}, ({
|
|
30
|
+
Bind,
|
|
31
|
+
submit
|
|
32
|
+
}) => /*#__PURE__*/React.createElement(View.Content, null, /*#__PURE__*/React.createElement(View.Title, {
|
|
33
|
+
title: "Set new password"
|
|
34
|
+
}), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
35
|
+
span: 12
|
|
36
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
37
|
+
name: "password",
|
|
38
|
+
validators: validation.create("required")
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
40
|
+
type: "password",
|
|
41
|
+
label: "New password",
|
|
42
|
+
size: "lg",
|
|
43
|
+
autoComplete: "off"
|
|
44
|
+
}))), /*#__PURE__*/React.createElement(React.Fragment, null, requiredAttributes.length > 0 && /*#__PURE__*/React.createElement(Grid.Column, {
|
|
45
|
+
span: 12
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
47
|
+
level: 6,
|
|
48
|
+
className: "wby-text-center"
|
|
49
|
+
}, "Please enter additional information"))), /*#__PURE__*/React.createElement(React.Fragment, null, requiredAttributes.map(name => /*#__PURE__*/React.createElement(Grid.Column, {
|
|
50
|
+
key: name,
|
|
51
|
+
span: 12
|
|
52
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
53
|
+
name: name,
|
|
54
|
+
validators: validation.create("required")
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
56
|
+
label: sentenceCase(name),
|
|
57
|
+
size: "lg"
|
|
58
|
+
}))))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
59
|
+
span: 12,
|
|
60
|
+
className: "wby-text-right"
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
62
|
+
text: "Set password",
|
|
63
|
+
"data-testid": "submit-sign-in-form-button",
|
|
64
|
+
onClick: ev => {
|
|
65
|
+
submit(ev);
|
|
66
|
+
},
|
|
67
|
+
size: "lg"
|
|
68
|
+
}))))));
|
|
78
69
|
};
|
|
79
70
|
|
|
80
|
-
|
|
71
|
+
//# sourceMappingURL=RequireNewPassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Button","Grid","Heading","Input","Form","validation","useRequireNewPassword","View","sentenceCase","str","lower","toLowerCase","toUpperCase","substring","RequireNewPassword","shouldRender","requiredAttributes","confirm","createElement","Container","onSubmit","password","submitOnEnter","Bind","submit","Content","Title","title","Column","span","name","validators","create","type","label","size","autoComplete","Fragment","length","level","className","map","key","text","onClick","ev"],"sources":["RequireNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Button, Grid, Heading, Input } from \"@webiny/admin-ui\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { useRequireNewPassword } from \"@webiny/app-cognito-authenticator/hooks/useRequireNewPassword\";\nimport { View } from \"~/components/View\";\n\nconst sentenceCase = (str: string) => {\n const lower = str.toLowerCase();\n return lower[0].toUpperCase() + lower.substring(1);\n};\n\nexport const RequireNewPassword = () => {\n const { shouldRender, requiredAttributes, confirm } = useRequireNewPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <View.Container>\n <Form\n onSubmit={({ password, requiredAttributes }) =>\n confirm({ password, requiredAttributes })\n }\n submitOnEnter\n >\n {({ Bind, 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 size={\"lg\"}\n autoComplete={\"off\"}\n />\n </Bind>\n </Grid.Column>\n\n <>\n {requiredAttributes.length > 0 && (\n <Grid.Column span={12}>\n <Heading level={6} className={\"wby-text-center\"}>\n Please enter additional information\n </Heading>\n </Grid.Column>\n )}\n </>\n\n <>\n {requiredAttributes.map(name => (\n <Grid.Column key={name} span={12}>\n <Bind\n name={name}\n validators={validation.create(\"required\")}\n >\n <Input label={sentenceCase(name)} size={\"lg\"} />\n </Bind>\n </Grid.Column>\n ))}\n </>\n\n <Grid.Column span={12} className={\"wby-text-right\"}>\n <Button\n text={\"Set password\"}\n data-testid=\"submit-sign-in-form-button\"\n onClick={ev => {\n submit(ev);\n }}\n size={\"lg\"}\n />\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,QAAQ,cAAc;AACnC,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,qBAAqB,QAAQ,+DAA+D;AACrG,SAASC,IAAI;AAEb,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;
|
|
3
|
-
export default SetNewPassword;
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const SetNewPassword: () => React.JSX.Element | null;
|
package/views/SetNewPassword.js
CHANGED
|
@@ -1,101 +1,94 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Form } from "@webiny/form";
|
|
3
3
|
import { validation } from "@webiny/validation";
|
|
4
|
-
import {
|
|
5
|
-
import { Input } from "@webiny/ui/Input";
|
|
6
|
-
import { Grid, Cell } from "@webiny/ui/Grid";
|
|
7
|
-
import { Typography } from "@webiny/ui/Typography";
|
|
8
|
-
import { Elevation } from "@webiny/ui/Elevation";
|
|
9
|
-
import { CircularProgress } from "@webiny/ui/Progress";
|
|
10
|
-
import StateContainer from "./StateContainer";
|
|
11
|
-
import { alignRight, InnerContent, Title, errorMessage } from "./StyledComponents";
|
|
4
|
+
import { View } from "../components/View";
|
|
12
5
|
import { useAuthenticator } from "@webiny/app-cognito-authenticator/hooks/useAuthenticator";
|
|
13
6
|
import { useSetNewPassword } from "@webiny/app-cognito-authenticator/hooks/useSetNewPassword";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (!shouldRender || checkingUser) {
|
|
7
|
+
import { Button, Grid, Input, Link, OverlayLoader, Text } from "@webiny/admin-ui";
|
|
8
|
+
export const SetNewPassword = () => {
|
|
9
|
+
const {
|
|
10
|
+
changeState
|
|
11
|
+
} = useAuthenticator();
|
|
12
|
+
const {
|
|
13
|
+
shouldRender,
|
|
14
|
+
setPassword,
|
|
15
|
+
error,
|
|
16
|
+
loading
|
|
17
|
+
} = useSetNewPassword();
|
|
18
|
+
if (!shouldRender) {
|
|
27
19
|
return null;
|
|
28
20
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
onSubmit: setPassword,
|
|
21
|
+
return /*#__PURE__*/React.createElement(View.Container, null, /*#__PURE__*/React.createElement(Form, {
|
|
22
|
+
onSubmit: data => setPassword(data),
|
|
32
23
|
submitOnEnter: true
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
}, ({
|
|
25
|
+
Bind,
|
|
26
|
+
submit,
|
|
27
|
+
data
|
|
28
|
+
}) => {
|
|
29
|
+
const retypePasswordValidator = value => {
|
|
39
30
|
if (value !== data.password) {
|
|
40
31
|
throw Error("Passwords do not match!");
|
|
41
32
|
}
|
|
42
33
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, "Set New Password"))), error && /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
34
|
+
return /*#__PURE__*/React.createElement(View.Content, null, loading && /*#__PURE__*/React.createElement(OverlayLoader, null), /*#__PURE__*/React.createElement(View.Title, {
|
|
35
|
+
title: "Set new password"
|
|
36
|
+
}), /*#__PURE__*/React.createElement(View.Error, {
|
|
37
|
+
description: error
|
|
38
|
+
}), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
49
39
|
span: 12,
|
|
50
|
-
|
|
51
|
-
}, error)), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
52
|
-
span: 12
|
|
40
|
+
"data-testid": "password-reset-code"
|
|
53
41
|
}, /*#__PURE__*/React.createElement(Bind, {
|
|
54
42
|
name: "code",
|
|
55
43
|
validators: validation.create("required")
|
|
56
44
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
45
|
+
size: "lg",
|
|
57
46
|
autoComplete: "off",
|
|
58
47
|
label: "Password reset code",
|
|
59
|
-
outlined: true,
|
|
60
48
|
description: "Enter the code we sent to your email."
|
|
61
|
-
}))), /*#__PURE__*/React.createElement(
|
|
62
|
-
span: 12
|
|
49
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
50
|
+
span: 12,
|
|
51
|
+
"data-testid": "new-password-input"
|
|
63
52
|
}, /*#__PURE__*/React.createElement(Bind, {
|
|
64
53
|
name: "password",
|
|
65
54
|
validators: validation.create("required")
|
|
66
55
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
56
|
+
size: "lg",
|
|
67
57
|
autoComplete: "off",
|
|
68
58
|
type: "password",
|
|
69
59
|
label: "New password",
|
|
70
|
-
outlined: true,
|
|
71
60
|
description: "Enter your new password."
|
|
72
|
-
}))), /*#__PURE__*/React.createElement(
|
|
73
|
-
span: 12
|
|
61
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
62
|
+
span: 12,
|
|
63
|
+
"data-testid": "retype-password-input"
|
|
74
64
|
}, /*#__PURE__*/React.createElement(Bind, {
|
|
75
65
|
name: "retypePassword",
|
|
76
66
|
validators: [validation.create("required"), retypePasswordValidator]
|
|
77
67
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
68
|
+
autoComplete: "off",
|
|
69
|
+
size: "lg",
|
|
78
70
|
type: "password",
|
|
79
71
|
label: "Retype password",
|
|
80
|
-
outlined: true,
|
|
81
72
|
description: "Enter your new password once more."
|
|
82
|
-
}))), /*#__PURE__*/React.createElement(
|
|
83
|
-
span: 12
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
73
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
74
|
+
span: 12
|
|
75
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "wby-flex wby-flex-row-reverse wby-items-center wby-justify-between"
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
78
|
+
text: "Set new password",
|
|
79
|
+
"data-testid": "submit-btn-new-psw",
|
|
80
|
+
onClick: ev => {
|
|
81
|
+
submit(ev);
|
|
82
|
+
},
|
|
83
|
+
size: "lg"
|
|
84
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
85
|
+
as: "div",
|
|
86
|
+
size: "sm"
|
|
87
|
+
}, "Want to sign in?\xA0", /*#__PURE__*/React.createElement(Link, {
|
|
88
|
+
to: "#",
|
|
89
|
+
onClick: () => changeState("signIn")
|
|
90
|
+
}, "Sign in"), ".")))));
|
|
98
91
|
}));
|
|
99
92
|
};
|
|
100
93
|
|
|
101
|
-
|
|
94
|
+
//# sourceMappingURL=SetNewPassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Form","validation","View","useAuthenticator","useSetNewPassword","Button","Grid","Input","Link","OverlayLoader","Text","SetNewPassword","changeState","shouldRender","setPassword","error","loading","createElement","Container","onSubmit","data","submitOnEnter","Bind","submit","retypePasswordValidator","value","password","Error","Content","Title","title","description","Column","span","name","validators","create","size","autoComplete","label","type","className","text","onClick","ev","as","to"],"sources":["SetNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { View } from \"~/components/View\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport type { UseSetNewPasswordCallableParams } from \"@webiny/app-cognito-authenticator/hooks/useSetNewPassword\";\nimport { useSetNewPassword } from \"@webiny/app-cognito-authenticator/hooks/useSetNewPassword\";\nimport { Button, Grid, Input, Link, OverlayLoader, Text } from \"@webiny/admin-ui\";\n\nexport const SetNewPassword = () => {\n const { changeState } = useAuthenticator();\n const { shouldRender, setPassword, error, loading } = useSetNewPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <View.Container>\n <Form<UseSetNewPasswordCallableParams>\n onSubmit={data => setPassword(data)}\n submitOnEnter\n >\n {({ Bind, submit, data }) => {\n const retypePasswordValidator = (value: string) => {\n if (value !== data.password) {\n throw Error(\"Passwords do not match!\");\n }\n };\n\n return (\n <View.Content>\n {loading && <OverlayLoader />}\n <View.Title title={\"Set new password\"} />\n <View.Error description={error} />\n\n <Grid>\n <Grid.Column span={12} data-testid=\"password-reset-code\">\n <Bind name=\"code\" validators={validation.create(\"required\")}>\n <Input\n size={\"lg\"}\n autoComplete=\"off\"\n label={\"Password reset code\"}\n description={\"Enter the code we sent to your email.\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12} data-testid=\"new-password-input\">\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input\n size={\"lg\"}\n autoComplete={\"off\"}\n type={\"password\"}\n label={\"New password\"}\n description={\"Enter your new password.\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12} data-testid=\"retype-password-input\">\n <Bind\n name=\"retypePassword\"\n validators={[\n validation.create(\"required\"),\n retypePasswordValidator\n ]}\n >\n <Input\n autoComplete={\"off\"}\n size={\"lg\"}\n type={\"password\"}\n label={\"Retype password\"}\n description={\"Enter your new password once more.\"}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <div\n className={\n \"wby-flex wby-flex-row-reverse wby-items-center wby-justify-between\"\n }\n >\n <Button\n text={\"Set new password\"}\n data-testid=\"submit-btn-new-psw\"\n onClick={ev => {\n submit(ev);\n }}\n size={\"lg\"}\n />\n <Text as={\"div\"} size={\"sm\"}>\n Want to sign in? \n <Link to={\"#\"} onClick={() => changeState(\"signIn\")}>\n Sign in\n </Link>\n .\n </Text>\n </div>\n </Grid.Column>\n </Grid>\n </View.Content>\n );\n }}\n </Form>\n </View.Container>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,IAAI;AACb,SAASC,gBAAgB,QAAQ,0DAA0D;AAE3F,SAASC,iBAAiB,QAAQ,2DAA2D;AAC7F,SAASC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