@webiny/app-admin-cognito 5.39.4-beta.0 → 5.39.4-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/components/Divider.d.ts +5 -0
- package/components/Divider.js +15 -0
- package/components/Divider.js.map +1 -0
- package/components/FederatedProviders.d.ts +18 -0
- package/components/FederatedProviders.js +25 -0
- package/components/FederatedProviders.js.map +1 -0
- package/{views → components}/StyledComponents.js +6 -6
- package/components/View.d.ts +46 -0
- package/components/View.js +51 -0
- package/components/View.js.map +1 -0
- package/federatedIdentityProviders.d.ts +9 -0
- package/federatedIdentityProviders.js +16 -0
- package/federatedIdentityProviders.js.map +1 -0
- package/index.d.ts +55 -6
- package/index.js +23 -12
- package/index.js.map +1 -1
- package/package.json +17 -14
- package/views/FederatedLogin.d.ts +2 -2
- package/views/FederatedLogin.js +19 -22
- package/views/FederatedLogin.js.map +1 -1
- package/views/ForgotPassword.d.ts +1 -2
- package/views/ForgotPassword.js +11 -22
- package/views/ForgotPassword.js.map +1 -1
- package/views/LoggingIn.d.ts +1 -2
- package/views/LoggingIn.js +2 -3
- package/views/LoggingIn.js.map +1 -1
- package/views/RequireNewPassword.d.ts +1 -2
- package/views/RequireNewPassword.js +9 -13
- package/views/RequireNewPassword.js.map +1 -1
- package/views/SetNewPassword.d.ts +1 -2
- package/views/SetNewPassword.js +11 -24
- package/views/SetNewPassword.js.map +1 -1
- package/views/SignIn.d.ts +19 -6
- package/views/SignIn.js +86 -77
- package/views/SignIn.js.map +1 -1
- package/views/SignedIn.d.ts +2 -2
- package/views/SignedIn.js +2 -3
- package/views/SignedIn.js.map +1 -1
- package/views/StateContainer.d.ts +0 -6
- package/views/StateContainer.js +0 -18
- package/views/StateContainer.js.map +0 -1
- package/views/webiny-orange-logo.svg +0 -23
- /package/{views → components}/StyledComponents.d.ts +0 -0
- /package/{views → components}/StyledComponents.js.map +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_auth","_federatedIdentityProviders","_FederatedProviders","FederatedLogin","_ref","providers","default","createElement","FederatedProviders","Container","map","_ref2","name","Component","component","cognitoProviderName","federatedIdentityProviders","isCustomProvider","signIn","Auth","federatedSignIn","customProvider","provider","key","exports"],"sources":["FederatedLogin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Auth } from \"@aws-amplify/auth\";\nimport { CognitoHostedUIIdentityProvider } from \"@aws-amplify/auth/lib-esm/types/Auth\";\nimport {\n federatedIdentityProviders,\n FederatedIdentityProvider\n} from \"~/federatedIdentityProviders\";\nimport { FederatedProviders } from \"~/components/FederatedProviders\";\n\ninterface FederatedLoginProps {\n providers: FederatedIdentityProvider[];\n}\n\nexport const FederatedLogin = ({ providers }: FederatedLoginProps) => {\n return (\n <FederatedProviders.Container>\n {providers.map(({ name, component: Component }) => {\n const cognitoProviderName = federatedIdentityProviders[name] ?? name;\n const isCustomProvider = !(name in federatedIdentityProviders);\n\n const signIn = () => {\n if (isCustomProvider) {\n Auth.federatedSignIn({\n customProvider: cognitoProviderName\n });\n } else {\n Auth.federatedSignIn({\n provider: cognitoProviderName as CognitoHostedUIIdentityProvider\n });\n }\n };\n\n return <Component key={name} signIn={signIn} />;\n })}\n </FederatedProviders.Container>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,2BAAA,GAAAF,OAAA;AAIA,IAAAG,mBAAA,GAAAH,OAAA;AAMO,IAAMI,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAA2C;EAAA,IAArCC,SAAS,GAAAD,IAAA,CAATC,SAAS;EACtC,oBACIR,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAACL,mBAAA,CAAAM,kBAAkB,CAACC,SAAS,QACxBJ,SAAS,CAACK,GAAG,CAAC,UAAAC,KAAA,EAAoC;IAAA,IAAjCC,IAAI,GAAAD,KAAA,CAAJC,IAAI;MAAaC,SAAS,GAAAF,KAAA,CAApBG,SAAS;IAC7B,IAAMC,mBAAmB,GAAGC,sDAA0B,CAACJ,IAAI,CAAC,IAAIA,IAAI;IACpE,IAAMK,gBAAgB,GAAG,EAAEL,IAAI,IAAII,sDAA0B,CAAC;IAE9D,IAAME,MAAM,GAAG,SAATA,MAAMA,CAAA,EAAS;MACjB,IAAID,gBAAgB,EAAE;QAClBE,UAAI,CAACC,eAAe,CAAC;UACjBC,cAAc,EAAEN;QACpB,CAAC,CAAC;MACN,CAAC,MAAM;QACHI,UAAI,CAACC,eAAe,CAAC;UACjBE,QAAQ,EAAEP;QACd,CAAC,CAAC;MACN;IACJ,CAAC;IAED,oBAAOlB,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAACM,SAAS;MAACU,GAAG,EAAEX,IAAK;MAACM,MAAM,EAAEA;IAAO,CAAE,CAAC;EACnD,CAAC,CACyB,CAAC;AAEvC,CAAC;AAACM,OAAA,CAAArB,cAAA,GAAAA,cAAA"}
|
package/views/ForgotPassword.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.
|
|
7
|
+
exports.ForgotPassword = void 0;
|
|
9
8
|
var React = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _form = require("@webiny/form");
|
|
11
10
|
var _validation = require("@webiny/validation");
|
|
@@ -14,12 +13,11 @@ var _Input = require("@webiny/ui/Input");
|
|
|
14
13
|
var _Grid = require("@webiny/ui/Grid");
|
|
15
14
|
var _Typography = require("@webiny/ui/Typography");
|
|
16
15
|
var _Alert = require("@webiny/ui/Alert");
|
|
17
|
-
var _Elevation = require("@webiny/ui/Elevation");
|
|
18
|
-
var _StateContainer = _interopRequireDefault(require("./StateContainer"));
|
|
19
|
-
var _StyledComponents = require("./StyledComponents");
|
|
20
16
|
var _Progress = require("@webiny/ui/Progress");
|
|
21
17
|
var _useAuthenticator2 = require("@webiny/app-cognito-authenticator/hooks/useAuthenticator");
|
|
22
18
|
var _useForgotPassword2 = require("@webiny/app-cognito-authenticator/hooks/useForgotPassword");
|
|
19
|
+
var _View = require("../components/View");
|
|
20
|
+
var _StyledComponents = require("../components/StyledComponents");
|
|
23
21
|
var ForgotPassword = function ForgotPassword() {
|
|
24
22
|
var _useAuthenticator = (0, _useAuthenticator2.useAuthenticator)(),
|
|
25
23
|
authData = _useAuthenticator.authData,
|
|
@@ -37,7 +35,7 @@ var ForgotPassword = function ForgotPassword() {
|
|
|
37
35
|
var _ref = authData || {},
|
|
38
36
|
_ref$username = _ref.username,
|
|
39
37
|
username = _ref$username === void 0 ? "" : _ref$username;
|
|
40
|
-
return /*#__PURE__*/React.createElement(
|
|
38
|
+
return /*#__PURE__*/React.createElement(_View.View.Container, null, /*#__PURE__*/React.createElement(_form.Form, {
|
|
41
39
|
data: {
|
|
42
40
|
username: username
|
|
43
41
|
},
|
|
@@ -54,13 +52,10 @@ var ForgotPassword = function ForgotPassword() {
|
|
|
54
52
|
var Bind = _ref3.Bind,
|
|
55
53
|
submit = _ref3.submit,
|
|
56
54
|
data = _ref3.data;
|
|
57
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, "Password Recovery")), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(_Typography.Typography, {
|
|
62
|
-
use: "body2"
|
|
63
|
-
}, "request a password reset code"))), error && /*#__PURE__*/React.createElement(_Grid.Grid, null, /*#__PURE__*/React.createElement(_Grid.Cell, {
|
|
55
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_View.View.Content, null, loading && /*#__PURE__*/React.createElement(_Progress.CircularProgress, null), /*#__PURE__*/React.createElement(_View.View.Title, {
|
|
56
|
+
title: "Password Recovery",
|
|
57
|
+
description: "request a password reset code"
|
|
58
|
+
}), error && /*#__PURE__*/React.createElement(_Grid.Grid, null, /*#__PURE__*/React.createElement(_Grid.Cell, {
|
|
64
59
|
span: 12
|
|
65
60
|
}, /*#__PURE__*/React.createElement(_Alert.Alert, {
|
|
66
61
|
title: "Something went wrong",
|
|
@@ -101,20 +96,14 @@ var ForgotPassword = function ForgotPassword() {
|
|
|
101
96
|
onClick: function onClick(ev) {
|
|
102
97
|
submit(ev);
|
|
103
98
|
}
|
|
104
|
-
}, "I got the code!")))))
|
|
105
|
-
span: 12,
|
|
106
|
-
style: {
|
|
107
|
-
textAlign: "center"
|
|
108
|
-
}
|
|
109
|
-
}, "Want to sign in? ", /*#__PURE__*/React.createElement("a", {
|
|
99
|
+
}, "I got the code!"))))), /*#__PURE__*/React.createElement(_View.View.Footer, null, "Want to sign in?\xA0", /*#__PURE__*/React.createElement("a", {
|
|
110
100
|
href: "#",
|
|
111
101
|
onClick: function onClick() {
|
|
112
102
|
return changeState("signIn");
|
|
113
103
|
}
|
|
114
|
-
}, "Sign in")))
|
|
104
|
+
}, "Sign in")));
|
|
115
105
|
}));
|
|
116
106
|
};
|
|
117
|
-
|
|
118
|
-
exports.default = _default;
|
|
107
|
+
exports.ForgotPassword = ForgotPassword;
|
|
119
108
|
|
|
120
109
|
//# sourceMappingURL=ForgotPassword.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","_interopRequireWildcard","require","_form","_validation","_Button","_Input","_Grid","_Typography","_Alert","_Elevation","_StateContainer","_interopRequireDefault","_StyledComponents","_Progress","_useAuthenticator2","_useForgotPassword2","ForgotPassword","_useAuthenticator","useAuthenticator","authData","changeState","_useForgotPassword","useForgotPassword","loading","codeSent","shouldRender","setPassword","requestCode","error","_ref","_ref$username","username","createElement","default","Form","data","onSubmit","_ref2","submitOnEnter","_ref3","Bind","submit","Fragment","Elevation","z","InnerContent","CircularProgress","Title","Typography","use","Grid","Cell","span","Alert","title","type","name","validators","validation","create","beforeChange","val","cb","toLowerCase","Input","label","description","className","alignRight","ButtonPrimary","onClick","ev","ButtonDefault","style","textAlign","href","_default","exports"],"sources":["ForgotPassword.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary, ButtonDefault } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Alert } from \"@webiny/ui/Alert\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, InnerContent, Title } from \"./StyledComponents\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport { useForgotPassword } from \"@webiny/app-cognito-authenticator/hooks/useForgotPassword\";\n\nconst 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 <StateContainer>\n <Form\n data={{ username }}\n onSubmit={({ username }) =>\n codeSent ? setPassword({ username }) : requestCode({ username })\n }\n submitOnEnter\n >\n {({ Bind, submit, data }) => (\n <>\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress />}\n <Title>\n <h1>\n <Typography use=\"headline4\">Password Recovery</Typography>\n </h1>\n <p>\n <Typography use=\"body2\">\n request a password reset code\n </Typography>\n </p>\n </Title>\n\n {error && (\n <Grid>\n <Cell span={12}>\n <Alert title={\"Something went wrong\"} type={\"danger\"}>\n {error}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n {!codeSent ? (\n <>\n <Grid>\n <Cell 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={\"Email\"}\n description={\n \"A reset code will be sent to your email.\"\n }\n />\n </Bind>\n </Cell>\n </Grid>\n\n <Grid>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n onClick={ev => {\n submit(ev);\n }}\n data-testid=\"send-code\"\n >\n {\"Send me the code\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </>\n ) : (\n <>\n <Grid>\n <Cell span={12}>\n <Typography use=\"body1\">\n We have sent you a code to reset your password!\n <br />\n <br />\n Click the "Resend code" button below\n to resend the code in case you haven't\n received it the first time.\n </Typography>\n </Cell>\n </Grid>\n <Grid>\n <Cell span={12} className={alignRight}>\n <ButtonDefault\n onClick={() => {\n requestCode({ username: data.username });\n }}\n >\n {\"Resend code\"}\n </ButtonDefault>\n <ButtonPrimary\n onClick={ev => {\n submit(ev);\n }}\n >\n I got the code!\n </ButtonPrimary>\n </Cell>\n </Grid>\n </>\n )}\n </InnerContent>\n </Elevation>\n <Grid>\n <Cell span={12} style={{ textAlign: \"center\" }}>\n Want to sign in? {/* eslint-disable-next-line */}\n <a href={\"#\"} onClick={() => changeState(\"signIn\")}>\n Sign in\n </a>\n </Cell>\n </Grid>\n </>\n )}\n </Form>\n </StateContainer>\n );\n};\n\nexport default ForgotPassword;\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,MAA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K,CAAC,eACNjC,KAAA,CAAAiC,aAAA,WAAK,CAAC,6GAIE,CACV,CACJ,CAAC,eACPjC,KAAA,CAAAiC,aAAA,CAAC1B,KAAA,CAAA4C,IAAI,qBACDnD,KAAA,CAAAiC,aAAA,CAAC1B,KAAA,CAAA6C,IAAI;MAACC,IAAI,EAAE,EAAG;MAACe,SAAS,EAAEC;IAAW,gBAClCrE,KAAA,CAAAiC,aAAA,CAAC5B,OAAA,CAAAoE,aAAa;MACVF,OAAO,EAAE,SAAAA,QAAA,EAAM;QACX3C,WAAW,CAAC;UAAEI,QAAQ,EAAEI,IAAI,CAACJ;QAAS,CAAC,CAAC;MAC5C;IAAE,GAED,aACU,CAAC,eAChBhC,KAAA,CAAAiC,aAAA,CAAC5B,OAAA,CAAAiE,aAAa;MACVC,OAAO,EAAE,SAAAA,QAAAC,EAAE,EAAI;QACX9B,MAAM,CAAC8B,EAAE,CAAC;MACd;IAAE,GACL,iBAEc,CACb,CACJ,CACR,CAEI,CACP,CAAC,eACZxE,KAAA,CAAAiC,aAAA,CAAC1B,KAAA,CAAA4C,IAAI,qBACDnD,KAAA,CAAAiC,aAAA,CAAC1B,KAAA,CAAA6C,IAAI;MAACC,IAAI,EAAE,EAAG;MAACqB,KAAK,EAAE;QAAEC,SAAS,EAAE;MAAS;IAAE,GAAC,mBAC3B,eACjB3E,KAAA,CAAAiC,aAAA;MAAG2C,IAAI,EAAE,GAAI;MAACL,OAAO,EAAE,SAAAA,QAAA;QAAA,OAAMlD,WAAW,CAAC,QAAQ,CAAC;MAAA;IAAC,GAAC,SAEjD,CACD,CACJ,CACR,CAAC;EAAA,CAEL,CACM,CAAC;AAEzB,CAAC;AAAC,IAAAwD,QAAA,GAEa5D,cAAc;AAAA6D,OAAA,CAAA5C,OAAA,GAAA2C,QAAA"}
|
|
1
|
+
{"version":3,"names":["React","_interopRequireWildcard","require","_form","_validation","_Button","_Input","_Grid","_Typography","_Alert","_Progress","_useAuthenticator2","_useForgotPassword2","_View","_StyledComponents","ForgotPassword","_useAuthenticator","useAuthenticator","authData","changeState","_useForgotPassword","useForgotPassword","loading","codeSent","shouldRender","setPassword","requestCode","error","_ref","_ref$username","username","createElement","View","Container","Form","data","onSubmit","_ref2","submitOnEnter","_ref3","Bind","submit","Fragment","Content","CircularProgress","Title","title","description","Grid","Cell","span","Alert","type","name","validators","validation","create","beforeChange","val","cb","toLowerCase","Input","label","className","alignRight","ButtonPrimary","onClick","ev","Typography","use","ButtonDefault","Footer","href","exports"],"sources":["ForgotPassword.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary, ButtonDefault } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Alert } from \"@webiny/ui/Alert\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport { useForgotPassword } from \"@webiny/app-cognito-authenticator/hooks/useForgotPassword\";\nimport { View } from \"~/components/View\";\nimport { alignRight } from \"~/components/StyledComponents\";\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 <>\n <View.Content>\n {loading && <CircularProgress />}\n <View.Title\n title={\"Password Recovery\"}\n description={\"request a password reset code\"}\n />\n {error && (\n <Grid>\n <Cell span={12}>\n <Alert title={\"Something went wrong\"} type={\"danger\"}>\n {error}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n {!codeSent ? (\n <>\n <Grid>\n <Cell 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={\"Email\"}\n description={\n \"A reset code will be sent to your email.\"\n }\n />\n </Bind>\n </Cell>\n </Grid>\n\n <Grid>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n onClick={ev => {\n submit(ev);\n }}\n data-testid=\"send-code\"\n >\n {\"Send me the code\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </>\n ) : (\n <>\n <Grid>\n <Cell span={12}>\n <Typography use=\"body1\">\n We have sent you a code to reset your password!\n <br />\n <br />\n Click the "Resend code" button below to\n resend the code in case you haven't received it\n the first time.\n </Typography>\n </Cell>\n </Grid>\n <Grid>\n <Cell span={12} className={alignRight}>\n <ButtonDefault\n onClick={() => {\n requestCode({ username: data.username });\n }}\n >\n {\"Resend code\"}\n </ButtonDefault>\n <ButtonPrimary\n onClick={ev => {\n submit(ev);\n }}\n >\n I got the code!\n </ButtonPrimary>\n </Cell>\n </Grid>\n </>\n )}\n </View.Content>\n <View.Footer>\n Want to sign in? \n <a href={\"#\"} onClick={() => changeState(\"signIn\")}>\n Sign in\n </a>\n </View.Footer>\n </>\n )}\n </Form>\n </View.Container>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAT,OAAA;AACA,IAAAU,mBAAA,GAAAV,OAAA;AACA,IAAAW,KAAA,GAAAX,OAAA;AACA,IAAAY,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4D,aAAa;MACVC,OAAO,EAAE,SAAAA,QAAAC,EAAE,EAAI;QACX1B,MAAM,CAAC0B,EAAE,CAAC;MACd;IAAE,GACL,iBAEc,CACb,CACJ,CACR,CAEI,CAAC,eACfnE,KAAA,CAAA+B,aAAA,CAAClB,KAAA,CAAAmB,IAAI,CAACuC,MAAM,QAAC,sBAET,eAAAvE,KAAA,CAAA+B,aAAA;MAAGyC,IAAI,EAAE,GAAI;MAACN,OAAO,EAAE,SAAAA,QAAA;QAAA,OAAM/C,WAAW,CAAC,QAAQ,CAAC;MAAA;IAAC,GAAC,SAEjD,CACM,CACf,CAAC;EAAA,CAEL,CACM,CAAC;AAEzB,CAAC;AAACsD,OAAA,CAAA1D,cAAA,GAAAA,cAAA"}
|
package/views/LoggingIn.d.ts
CHANGED
package/views/LoggingIn.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.LoggingIn = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _Progress = require("@webiny/ui/Progress");
|
|
10
10
|
var LoggingIn = function LoggingIn() {
|
|
@@ -12,7 +12,6 @@ var LoggingIn = function LoggingIn() {
|
|
|
12
12
|
label: "Loading identity..."
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
exports.default = _default;
|
|
15
|
+
exports.LoggingIn = LoggingIn;
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=LoggingIn.js.map
|
package/views/LoggingIn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_Progress","LoggingIn","default","createElement","CircularProgress","label","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_Progress","LoggingIn","default","createElement","CircularProgress","label","exports"],"sources":["LoggingIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\n\nexport const LoggingIn = () => {\n return <CircularProgress label={\"Loading identity...\"} />;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEO,IAAME,SAAS,GAAG,SAAZA,SAASA,CAAA,EAAS;EAC3B,oBAAOJ,MAAA,CAAAK,OAAA,CAAAC,aAAA,CAACH,SAAA,CAAAI,gBAAgB;IAACC,KAAK,EAAE;EAAsB,CAAE,CAAC;AAC7D,CAAC;AAACC,OAAA,CAAAL,SAAA,GAAAA,SAAA"}
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.RequireNewPassword = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _form = require("@webiny/form");
|
|
10
10
|
var _validation = require("@webiny/validation");
|
|
@@ -12,10 +12,9 @@ var _Button = require("@webiny/ui/Button");
|
|
|
12
12
|
var _Input = require("@webiny/ui/Input");
|
|
13
13
|
var _Grid = require("@webiny/ui/Grid");
|
|
14
14
|
var _Typography = require("@webiny/ui/Typography");
|
|
15
|
-
var _Elevation = require("@webiny/ui/Elevation");
|
|
16
15
|
var _useRequireNewPassword = require("@webiny/app-cognito-authenticator/hooks/useRequireNewPassword");
|
|
17
|
-
var
|
|
18
|
-
var _StyledComponents = require("
|
|
16
|
+
var _View = require("../components/View");
|
|
17
|
+
var _StyledComponents = require("../components/StyledComponents");
|
|
19
18
|
var sentenceCase = function sentenceCase(str) {
|
|
20
19
|
var lower = str.toLowerCase();
|
|
21
20
|
return lower[0].toUpperCase() + lower.substring(1);
|
|
@@ -28,7 +27,7 @@ var RequireNewPassword = function RequireNewPassword() {
|
|
|
28
27
|
if (!shouldRender) {
|
|
29
28
|
return null;
|
|
30
29
|
}
|
|
31
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_View.View.Container, null, /*#__PURE__*/_react.default.createElement(_form.Form, {
|
|
32
31
|
onSubmit: function onSubmit(_ref) {
|
|
33
32
|
var password = _ref.password,
|
|
34
33
|
requiredAttributes = _ref.requiredAttributes;
|
|
@@ -41,11 +40,9 @@ var RequireNewPassword = function RequireNewPassword() {
|
|
|
41
40
|
}, function (_ref2) {
|
|
42
41
|
var Bind = _ref2.Bind,
|
|
43
42
|
submit = _ref2.submit;
|
|
44
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
45
|
-
|
|
46
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
47
|
-
use: "headline4"
|
|
48
|
-
}, "Set New Password")), /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_View.View.Content, null, /*#__PURE__*/_react.default.createElement(_View.View.Title, {
|
|
44
|
+
title: "Set New Password"
|
|
45
|
+
}), /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
49
46
|
span: 12
|
|
50
47
|
}, /*#__PURE__*/_react.default.createElement(Bind, {
|
|
51
48
|
name: "password",
|
|
@@ -75,10 +72,9 @@ var RequireNewPassword = function RequireNewPassword() {
|
|
|
75
72
|
onClick: function onClick(ev) {
|
|
76
73
|
submit(ev);
|
|
77
74
|
}
|
|
78
|
-
}, "Set password"))))
|
|
75
|
+
}, "Set password"))));
|
|
79
76
|
}));
|
|
80
77
|
};
|
|
81
|
-
|
|
82
|
-
exports.default = _default;
|
|
78
|
+
exports.RequireNewPassword = RequireNewPassword;
|
|
83
79
|
|
|
84
80
|
//# sourceMappingURL=RequireNewPassword.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_form","_validation","_Button","_Input","_Grid","_Typography","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_form","_validation","_Button","_Input","_Grid","_Typography","_useRequireNewPassword","_View","_StyledComponents","sentenceCase","str","lower","toLowerCase","toUpperCase","substring","RequireNewPassword","_useRequireNewPasswor","useRequireNewPassword","shouldRender","requiredAttributes","confirm","default","createElement","View","Container","Form","onSubmit","_ref","password","submitOnEnter","_ref2","Bind","submit","Content","Title","title","Grid","Cell","span","name","validators","validation","create","Input","type","label","outlined","length","Typography","use","map","key","className","alignRight","ButtonPrimary","onClick","ev","exports"],"sources":["RequireNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { useRequireNewPassword } from \"@webiny/app-cognito-authenticator/hooks/useRequireNewPassword\";\nimport { View } from \"~/components/View\";\nimport { alignRight, Title } from \"~/components/StyledComponents\";\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 <Cell span={12}>\n <Bind name=\"password\" validators={validation.create(\"required\")}>\n <Input\n type={\"password\"}\n label={\"New password\"}\n outlined={true}\n />\n </Bind>\n </Cell>\n </Grid>\n {requiredAttributes.length > 0 && (\n <Title>\n <Typography use=\"headline6\">\n Please enter additional information\n </Typography>\n </Title>\n )}\n <Grid>\n {requiredAttributes.map(name => (\n <Cell key={name} span={12}>\n <Bind name={name} validators={validation.create(\"required\")}>\n <Input label={sentenceCase(name)} outlined={true} />\n </Bind>\n </Cell>\n ))}\n </Grid>\n\n <Grid>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n data-testid=\"submit-sign-in-form-button\"\n onClick={ev => {\n submit(ev);\n }}\n >\n {\"Set password\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </View.Content>\n )}\n </Form>\n </View.Container>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,sBAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AAEA,IAAMU,YAAY,GAAG,SAAfA,YAAYA,CAAIC,GAAW,EAAK;EAClC,IAAMC,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;AAEM,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAA,EAAS;EACpC,IAAAC,qBAAA,GAAsD,IAAAC,4CAAqB,EAAC,CAAC;IAArEC,YAAY,GAAAF,qBAAA,CAAZE,YAAY;IAAEC,kBAAkB,GAAAH,qBAAA,CAAlBG,kBAAkB;IAAEC,OAAO,GAAAJ,qBAAA,CAAPI,OAAO;EAEjD,IAAI,CAACF,YAAY,EAAE;IACf,OAAO,IAAI;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A1C,kBAAA,GAAAA,kBAAA"}
|
package/views/SetNewPassword.js
CHANGED
|
@@ -4,18 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.SetNewPassword = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _form = require("@webiny/form");
|
|
10
10
|
var _validation = require("@webiny/validation");
|
|
11
11
|
var _Button = require("@webiny/ui/Button");
|
|
12
12
|
var _Input = require("@webiny/ui/Input");
|
|
13
13
|
var _Grid = require("@webiny/ui/Grid");
|
|
14
|
-
var _Typography = require("@webiny/ui/Typography");
|
|
15
|
-
var _Elevation = require("@webiny/ui/Elevation");
|
|
16
14
|
var _Progress = require("@webiny/ui/Progress");
|
|
17
|
-
var
|
|
18
|
-
var _StyledComponents = require("
|
|
15
|
+
var _View = require("../components/View");
|
|
16
|
+
var _StyledComponents = require("../components/StyledComponents");
|
|
19
17
|
var _useAuthenticator2 = require("@webiny/app-cognito-authenticator/hooks/useAuthenticator");
|
|
20
18
|
var _useSetNewPassword2 = require("@webiny/app-cognito-authenticator/hooks/useSetNewPassword");
|
|
21
19
|
var SetNewPassword = function SetNewPassword() {
|
|
@@ -29,11 +27,8 @@ var SetNewPassword = function SetNewPassword() {
|
|
|
29
27
|
if (!shouldRender) {
|
|
30
28
|
return null;
|
|
31
29
|
}
|
|
32
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_form.Form, {
|
|
33
31
|
onSubmit: function onSubmit(data) {
|
|
34
|
-
/**
|
|
35
|
-
* We are positive that data is UseSetNewPasswordCallableParams
|
|
36
|
-
*/
|
|
37
32
|
return setPassword(data);
|
|
38
33
|
},
|
|
39
34
|
submitOnEnter: true
|
|
@@ -46,11 +41,9 @@ var SetNewPassword = function SetNewPassword() {
|
|
|
46
41
|
throw Error("Passwords do not match!");
|
|
47
42
|
}
|
|
48
43
|
};
|
|
49
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
use: "headline4"
|
|
53
|
-
}, "Set New Password"))), error && /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_View.View.Container, null, /*#__PURE__*/_react.default.createElement(_View.View.Content, null, loading && /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, null), /*#__PURE__*/_react.default.createElement(_View.View.Title, {
|
|
45
|
+
title: "Set New Password"
|
|
46
|
+
}), error && /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
54
47
|
span: 12,
|
|
55
48
|
className: _StyledComponents.errorMessage
|
|
56
49
|
}, error)), /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
@@ -95,20 +88,14 @@ var SetNewPassword = function SetNewPassword() {
|
|
|
95
88
|
onClick: function onClick(ev) {
|
|
96
89
|
submit(ev);
|
|
97
90
|
}
|
|
98
|
-
}, "Set new password"))))
|
|
99
|
-
span: 12,
|
|
100
|
-
style: {
|
|
101
|
-
textAlign: "center"
|
|
102
|
-
}
|
|
103
|
-
}, "Want to sign in? ", /*#__PURE__*/_react.default.createElement("a", {
|
|
91
|
+
}, "Set new password")))), /*#__PURE__*/_react.default.createElement(_View.View.Footer, null, "Want to sign in?\xA0", /*#__PURE__*/_react.default.createElement("a", {
|
|
104
92
|
href: "#",
|
|
105
93
|
onClick: function onClick() {
|
|
106
94
|
return changeState("signIn");
|
|
107
95
|
}
|
|
108
|
-
}, "Sign in")))
|
|
109
|
-
})
|
|
96
|
+
}, "Sign in")));
|
|
97
|
+
});
|
|
110
98
|
};
|
|
111
|
-
|
|
112
|
-
exports.default = _default;
|
|
99
|
+
exports.SetNewPassword = SetNewPassword;
|
|
113
100
|
|
|
114
101
|
//# sourceMappingURL=SetNewPassword.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_form","_validation","_Button","_Input","_Grid","_Typography","_Elevation","_Progress","_StateContainer","_StyledComponents","_useAuthenticator2","_useSetNewPassword2","SetNewPassword","_useAuthenticator","useAuthenticator","changeState","_useSetNewPassword","useSetNewPassword","shouldRender","setPassword","error","loading","default","createElement","Form","onSubmit","data","submitOnEnter","_ref","Bind","submit","retypePasswordValidator","value","password","Error","Fragment","Elevation","z","InnerContent","CircularProgress","Title","Typography","use","Grid","Cell","span","className","errorMessage","name","validators","validation","create","Input","autoComplete","label","outlined","description","type","alignRight","ButtonPrimary","onClick","ev","style","textAlign","href","_default","exports"],"sources":["SetNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, InnerContent, Title, errorMessage } from \"./StyledComponents\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport {\n useSetNewPassword,\n UseSetNewPasswordCallableParams\n} from \"@webiny/app-cognito-authenticator/hooks/useSetNewPassword\";\n\nconst SetNewPassword = () => {\n const { changeState } = useAuthenticator();\n const { shouldRender, setPassword, error, loading } = useSetNewPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <StateContainer>\n <Form\n onSubmit={data => {\n /**\n * We are positive that data is UseSetNewPasswordCallableParams\n */\n return setPassword(data as unknown as UseSetNewPasswordCallableParams);\n }}\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 <>\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress />}\n <Title>\n <h1>\n <Typography use=\"headline4\">\n Set New Password\n </Typography>\n </h1>\n </Title>\n\n {error && (\n <Grid>\n <Cell span={12} className={errorMessage}>\n {error}\n </Cell>\n </Grid>\n )}\n\n <Grid>\n <Cell span={12} data-testid=\"password-reset-code\">\n <Bind\n name=\"code\"\n validators={validation.create(\"required\")}\n >\n <Input\n autoComplete=\"off\"\n label={\"Password reset code\"}\n outlined={true}\n description={\n \"Enter the code we sent to your email.\"\n }\n />\n </Bind>\n </Cell>\n <Cell span={12} data-testid=\"new-password-input\">\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input\n autoComplete={\"off\"}\n type={\"password\"}\n label={\"New password\"}\n outlined={true}\n description={\"Enter your new password.\"}\n />\n </Bind>\n </Cell>\n <Cell 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 type={\"password\"}\n label={\"Retype password\"}\n outlined={true}\n description={\n \"Enter your new password once more.\"\n }\n />\n </Bind>\n </Cell>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n data-testid=\"submit-btn-new-psw\"\n onClick={ev => {\n submit(ev);\n }}\n >\n {\"Set new password\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </InnerContent>\n </Elevation>\n <Grid>\n <Cell span={12} style={{ textAlign: \"center\" }}>\n Want to sign in? {/* eslint-disable-next-line */}\n <a href={\"#\"} onClick={() => changeState(\"signIn\")}>\n Sign in\n </a>\n </Cell>\n </Grid>\n </>\n );\n }}\n </Form>\n </StateContainer>\n );\n};\n\nexport default SetNewPassword;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAA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,EACP;IACH,CACJ,CACC,CACJ,CAAC,eACP3D,MAAA,CAAAyB,OAAA,CAAAC,aAAA,CAACnB,KAAA,CAAAwC,IAAI;MAACC,IAAI,EAAE,EAAG;MAACC,SAAS,EAAEY;IAAW,gBAClC7D,MAAA,CAAAyB,OAAA,CAAAC,aAAA,CAACrB,OAAA,CAAAyD,aAAa;MACV,eAAY,oBAAoB;MAChCC,OAAO,EAAE,SAAAA,QAAAC,EAAE,EAAI;QACX/B,MAAM,CAAC+B,EAAE,CAAC;MACd;IAAE,GAED,kBACU,CACb,CACJ,CACI,CACP,CAAC,eACZhE,MAAA,CAAAyB,OAAA,CAAAC,aAAA,CAACnB,KAAA,CAAAuC,IAAI,qBACD9C,MAAA,CAAAyB,OAAA,CAAAC,aAAA,CAACnB,KAAA,CAAAwC,IAAI;MAACC,IAAI,EAAE,EAAG;MAACiB,KAAK,EAAE;QAAEC,SAAS,EAAE;MAAS;IAAE,GAAC,mBAC3B,eACjBlE,MAAA,CAAAyB,OAAA,CAAAC,aAAA;MAAGyC,IAAI,EAAE,GAAI;MAACJ,OAAO,EAAE,SAAAA,QAAA;QAAA,OAAM7C,WAAW,CAAC,QAAQ,CAAC;MAAA;IAAC,GAAC,SAEjD,CACD,CACJ,CACR,CAAC;EAEX,CACE,CACM,CAAC;AAEzB,CAAC;AAAC,IAAAkD,QAAA,GAEarD,cAAc;AAAAsD,OAAA,CAAA5C,OAAA,GAAA2C,QAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_form","_validation","_Button","_Input","_Grid","_Progress","_View","_StyledComponents","_useAuthenticator2","_useSetNewPassword2","SetNewPassword","_useAuthenticator","useAuthenticator","changeState","_useSetNewPassword","useSetNewPassword","shouldRender","setPassword","error","loading","default","createElement","Form","onSubmit","data","submitOnEnter","_ref","Bind","submit","retypePasswordValidator","value","password","Error","View","Container","Content","CircularProgress","Title","title","Grid","Cell","span","className","errorMessage","name","validators","validation","create","Input","autoComplete","label","outlined","description","type","alignRight","ButtonPrimary","onClick","ev","Footer","href","exports"],"sources":["SetNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { View } from \"~/components/View\";\nimport { alignRight, errorMessage } from \"~/components/StyledComponents\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport {\n useSetNewPassword,\n UseSetNewPasswordCallableParams\n} from \"@webiny/app-cognito-authenticator/hooks/useSetNewPassword\";\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 <Form<UseSetNewPasswordCallableParams> onSubmit={data => setPassword(data)} submitOnEnter>\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.Container>\n <View.Content>\n {loading && <CircularProgress />}\n <View.Title title={\"Set New Password\"} />\n\n {error && (\n <Grid>\n <Cell span={12} className={errorMessage}>\n {error}\n </Cell>\n </Grid>\n )}\n\n <Grid>\n <Cell span={12} data-testid=\"password-reset-code\">\n <Bind name=\"code\" validators={validation.create(\"required\")}>\n <Input\n autoComplete=\"off\"\n label={\"Password reset code\"}\n outlined={true}\n description={\"Enter the code we sent to your email.\"}\n />\n </Bind>\n </Cell>\n <Cell span={12} data-testid=\"new-password-input\">\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input\n autoComplete={\"off\"}\n type={\"password\"}\n label={\"New password\"}\n outlined={true}\n description={\"Enter your new password.\"}\n />\n </Bind>\n </Cell>\n <Cell 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 type={\"password\"}\n label={\"Retype password\"}\n outlined={true}\n description={\"Enter your new password once more.\"}\n />\n </Bind>\n </Cell>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n data-testid=\"submit-btn-new-psw\"\n onClick={ev => {\n submit(ev);\n }}\n >\n {\"Set new password\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </View.Content>\n <View.Footer>\n Want to sign in? \n <a href={\"#\"} onClick={() => changeState(\"signIn\")}>\n Sign in\n </a>\n </View.Footer>\n </View.Container>\n );\n }}\n </Form>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAT,OAAA;AACA,IAAAU,mBAAA,GAAAV,OAAA;AAKO,IAAMW,cAAc,GAAG,SAAjBA,cAAcA,CAAA,EAAS;EAChC,IAAAC,iBAAA,GAAwB,IAAAC,mCAAgB,EAAC,CAAC;IAAlCC,WAAW,GAAAF,iBAAA,CAAXE,WAAW;EACnB,IAAAC,kBAAA,GAAsD,IAAAC,qCAAiB,EAAC,CAAC;IAAjEC,YAAY,GAAAF,kBAAA,CAAZE,YAAY;IAAEC,WAAW,GAAAH,kBAAA,CAAXG,WAAW;IAAEC,KAAK,GAAAJ,kBAAA,CAALI,KAAK;IAAEC,OAAO,GAAAL,kBAAA,CAAPK,OAAO;EAEjD,IAAI,CAACH,YAAY,EAAE;IACf,OAAO,IAAI;EACf;EAEA,oBACInB,MAAA,CAAAuB,OA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jBH,KAAK,EAAE,iBAAkB;MACzBC,QAAQ,EAAE,IAAK;MACfC,WAAW,EAAE;IAAqC,CACrD,CACC,CACJ,CAAC,eACPvD,MAAA,CAAAuB,OAAA,CAAAC,aAAA,CAACjB,KAAA,CAAAoC,IAAI;MAACC,IAAI,EAAE,EAAG;MAACC,SAAS,EAAEY;IAAW,gBAClCzD,MAAA,CAAAuB,OAAA,CAAAC,aAAA,CAACnB,OAAA,CAAAqD,aAAa;MACV,eAAY,oBAAoB;MAChCC,OAAO,EAAE,SAAAA,QAAAC,EAAE,EAAI;QACX7B,MAAM,CAAC6B,EAAE,CAAC;MACd;IAAE,GAED,kBACU,CACb,CACJ,CACI,CAAC,eACf5D,MAAA,CAAAuB,OAAA,CAAAC,aAAA,CAACf,KAAA,CAAA2B,IAAI,CAACyB,MAAM,QAAC,sBAET,eAAA7D,MAAA,CAAAuB,OAAA,CAAAC,aAAA;MAAGsC,IAAI,EAAE,GAAI;MAACH,OAAO,EAAE,SAAAA,QAAA;QAAA,OAAM3C,WAAW,CAAC,QAAQ,CAAC;MAAA;IAAC,GAAC,SAEjD,CACM,CACD,CAAC;EAEzB,CACE,CAAC;AAEf,CAAC;AAAC+C,OAAA,CAAAlD,cAAA,GAAAA,cAAA"}
|
package/views/SignIn.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
interface SignInProps {
|
|
4
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FederatedIdentityProvider } from "../federatedIdentityProviders";
|
|
3
|
+
export interface SignInProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* This prop lets you override the entire content of the view.
|
|
8
|
+
* You'll need to implement your own title, description, and content rendering.
|
|
9
|
+
*/
|
|
10
|
+
content?: React.ReactNode;
|
|
11
|
+
footer?: React.ReactNode;
|
|
12
|
+
allowSignInWithCredentials?: boolean;
|
|
13
|
+
federatedProviders?: FederatedIdentityProvider[];
|
|
5
14
|
}
|
|
6
|
-
declare const SignIn: (
|
|
7
|
-
|
|
15
|
+
export declare const SignIn: import("@webiny/app-admin").GenericComponent<SignInProps> & {
|
|
16
|
+
original: import("@webiny/app-admin").GenericComponent<SignInProps>;
|
|
17
|
+
originalName: string;
|
|
18
|
+
} & {
|
|
19
|
+
createDecorator: (decorator: import("@webiny/app-admin").Decorator<(props: SignInProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
20
|
+
};
|