@webiny/app-admin-cognito 5.34.8 → 5.35.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/index.js +83 -136
- package/index.js.map +1 -1
- package/package.json +14 -14
- package/views/ForgotPassword.js +12 -34
- package/views/ForgotPassword.js.map +1 -1
- package/views/LoggingIn.js +0 -5
- package/views/LoggingIn.js.map +1 -1
- package/views/RequireNewPassword.js +5 -22
- package/views/RequireNewPassword.js.map +1 -1
- package/views/SetNewPassword.js +7 -28
- package/views/SetNewPassword.js.map +1 -1
- package/views/SignIn.js +7 -27
- package/views/SignIn.js.map +1 -1
- package/views/SignedIn.js +1 -6
- package/views/SignedIn.js.map +1 -1
- package/views/StateContainer.js +0 -6
- package/views/StateContainer.js.map +1 -1
- package/views/StyledComponents.d.ts +25 -7
- package/views/StyledComponents.js +0 -4
- package/views/StyledComponents.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,126 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.createAuthentication = void 0;
|
|
11
|
-
|
|
12
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
|
|
14
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
11
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
17
|
-
|
|
18
12
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
19
|
-
|
|
20
13
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
21
|
-
|
|
22
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
-
|
|
24
15
|
var _auth = require("@aws-amplify/auth");
|
|
25
|
-
|
|
26
16
|
var _reactHooks = require("@apollo/react-hooks");
|
|
27
|
-
|
|
28
17
|
var _apolloLinkContext = require("apollo-link-context");
|
|
29
|
-
|
|
30
18
|
var _plugins = require("@webiny/plugins");
|
|
31
|
-
|
|
32
19
|
var _ApolloLinkPlugin = require("@webiny/app/plugins/ApolloLinkPlugin");
|
|
33
|
-
|
|
34
20
|
var _Authenticator = require("@webiny/app-cognito-authenticator/Authenticator");
|
|
35
|
-
|
|
36
21
|
var _SignIn = _interopRequireDefault(require("./views/SignIn"));
|
|
37
|
-
|
|
38
22
|
var _RequireNewPassword = _interopRequireDefault(require("./views/RequireNewPassword"));
|
|
39
|
-
|
|
40
23
|
var _ForgotPassword = _interopRequireDefault(require("./views/ForgotPassword"));
|
|
41
|
-
|
|
42
24
|
var _SetNewPassword = _interopRequireDefault(require("./views/SetNewPassword"));
|
|
43
|
-
|
|
44
25
|
var _SignedIn = _interopRequireDefault(require("./views/SignedIn"));
|
|
45
|
-
|
|
46
26
|
var _appSecurity = require("@webiny/app-security");
|
|
47
|
-
|
|
48
27
|
var _config = require("@webiny/app/config");
|
|
49
|
-
|
|
50
28
|
var _LoggingIn = _interopRequireDefault(require("./views/LoggingIn"));
|
|
51
|
-
|
|
52
29
|
var _excluded = ["getIdentityData", "onError"],
|
|
53
|
-
|
|
54
|
-
|
|
30
|
+
_excluded2 = ["id", "displayName", "type", "permissions"];
|
|
55
31
|
var createApolloLinkPlugin = function createApolloLinkPlugin() {
|
|
56
32
|
return new _ApolloLinkPlugin.ApolloLinkPlugin(function () {
|
|
57
33
|
return (0, _apolloLinkContext.setContext)( /*#__PURE__*/function () {
|
|
58
34
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(_, _ref) {
|
|
59
35
|
var headers, user, idToken;
|
|
60
36
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
61
|
-
while (1) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
headers: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, headers), {}, {
|
|
94
|
-
Authorization: "Bearer ".concat(idToken.getJwtToken())
|
|
95
|
-
})
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
case 10:
|
|
99
|
-
case "end":
|
|
100
|
-
return _context.stop();
|
|
101
|
-
}
|
|
37
|
+
while (1) switch (_context.prev = _context.next) {
|
|
38
|
+
case 0:
|
|
39
|
+
headers = _ref.headers;
|
|
40
|
+
_context.next = 3;
|
|
41
|
+
return _auth.Auth.currentSession();
|
|
42
|
+
case 3:
|
|
43
|
+
user = _context.sent;
|
|
44
|
+
idToken = user.getIdToken();
|
|
45
|
+
if (idToken) {
|
|
46
|
+
_context.next = 7;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
return _context.abrupt("return", {
|
|
50
|
+
headers: headers
|
|
51
|
+
});
|
|
52
|
+
case 7:
|
|
53
|
+
if (!(headers && headers.Authorization)) {
|
|
54
|
+
_context.next = 9;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
return _context.abrupt("return", {
|
|
58
|
+
headers: headers
|
|
59
|
+
});
|
|
60
|
+
case 9:
|
|
61
|
+
return _context.abrupt("return", {
|
|
62
|
+
headers: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, headers), {}, {
|
|
63
|
+
Authorization: "Bearer ".concat(idToken.getJwtToken())
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
case 10:
|
|
67
|
+
case "end":
|
|
68
|
+
return _context.stop();
|
|
102
69
|
}
|
|
103
70
|
}, _callee);
|
|
104
71
|
}));
|
|
105
|
-
|
|
106
72
|
return function (_x, _x2) {
|
|
107
73
|
return _ref2.apply(this, arguments);
|
|
108
74
|
};
|
|
109
75
|
}());
|
|
110
76
|
});
|
|
111
77
|
};
|
|
112
|
-
|
|
113
78
|
var defaultOptions = {
|
|
114
79
|
region: _config.config.getKey("USER_POOL_REGION", process.env.REACT_APP_USER_POOL_REGION),
|
|
115
80
|
userPoolId: _config.config.getKey("USER_POOL_ID", process.env.REACT_APP_USER_POOL_ID),
|
|
116
81
|
userPoolWebClientId: _config.config.getKey("USER_POOL_WEB_CLIENT_ID", process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID)
|
|
117
82
|
};
|
|
118
|
-
|
|
119
83
|
var createAuthentication = function createAuthentication(_ref3) {
|
|
120
84
|
var getIdentityData = _ref3.getIdentityData,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
85
|
+
onError = _ref3.onError,
|
|
86
|
+
config = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
|
|
124
87
|
/**
|
|
125
88
|
* TODO @ts-refactor
|
|
126
89
|
*/
|
|
@@ -128,82 +91,68 @@ var createAuthentication = function createAuthentication(_ref3) {
|
|
|
128
91
|
Object.keys(config).forEach(function (key) {
|
|
129
92
|
return config[key] === undefined && delete config[key];
|
|
130
93
|
});
|
|
131
|
-
|
|
132
94
|
_auth.Auth.configure((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultOptions), config));
|
|
133
|
-
|
|
134
95
|
var Authentication = function Authentication(props) {
|
|
135
96
|
var children = props.children;
|
|
136
|
-
|
|
137
97
|
var _useState = (0, _react.useState)(false),
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
98
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
99
|
+
loadingIdentity = _useState2[0],
|
|
100
|
+
setLoadingIdentity = _useState2[1];
|
|
142
101
|
var _useSecurity = (0, _appSecurity.useSecurity)(),
|
|
143
|
-
|
|
144
|
-
|
|
102
|
+
setIdentity = _useSecurity.setIdentity;
|
|
145
103
|
var client = (0, _reactHooks.useApolloClient)();
|
|
146
104
|
var onToken = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
147
105
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(token) {
|
|
148
106
|
var payload, logout, _yield$getIdentityDat, id, displayName, type, permissions, data;
|
|
149
|
-
|
|
150
107
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
151
|
-
while (1) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
logout: logout || function () {
|
|
177
|
-
return void 0;
|
|
178
|
-
}
|
|
179
|
-
}));
|
|
180
|
-
_context2.next = 18;
|
|
181
|
-
break;
|
|
182
|
-
|
|
183
|
-
case 14:
|
|
184
|
-
_context2.prev = 14;
|
|
185
|
-
_context2.t0 = _context2["catch"](2);
|
|
186
|
-
console.log("ERROR", _context2.t0);
|
|
187
|
-
|
|
188
|
-
if (typeof onError === "function") {
|
|
189
|
-
onError(_context2.t0);
|
|
190
|
-
} else {
|
|
191
|
-
console.error(_context2.t0);
|
|
108
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
109
|
+
case 0:
|
|
110
|
+
payload = token.payload, logout = token.logout;
|
|
111
|
+
setLoadingIdentity(true);
|
|
112
|
+
_context2.prev = 2;
|
|
113
|
+
_context2.next = 5;
|
|
114
|
+
return getIdentityData({
|
|
115
|
+
client: client,
|
|
116
|
+
payload: payload
|
|
117
|
+
});
|
|
118
|
+
case 5:
|
|
119
|
+
_yield$getIdentityDat = _context2.sent;
|
|
120
|
+
id = _yield$getIdentityDat.id;
|
|
121
|
+
displayName = _yield$getIdentityDat.displayName;
|
|
122
|
+
type = _yield$getIdentityDat.type;
|
|
123
|
+
permissions = _yield$getIdentityDat.permissions;
|
|
124
|
+
data = (0, _objectWithoutProperties2.default)(_yield$getIdentityDat, _excluded2);
|
|
125
|
+
setIdentity((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
126
|
+
id: id,
|
|
127
|
+
displayName: displayName,
|
|
128
|
+
type: type,
|
|
129
|
+
permissions: permissions
|
|
130
|
+
}, data), {}, {
|
|
131
|
+
logout: logout || function () {
|
|
132
|
+
return void 0;
|
|
192
133
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
134
|
+
}));
|
|
135
|
+
_context2.next = 18;
|
|
136
|
+
break;
|
|
137
|
+
case 14:
|
|
138
|
+
_context2.prev = 14;
|
|
139
|
+
_context2.t0 = _context2["catch"](2);
|
|
140
|
+
console.log("ERROR", _context2.t0);
|
|
141
|
+
if (typeof onError === "function") {
|
|
142
|
+
onError(_context2.t0);
|
|
143
|
+
} else {
|
|
144
|
+
console.error(_context2.t0);
|
|
145
|
+
}
|
|
146
|
+
case 18:
|
|
147
|
+
_context2.prev = 18;
|
|
148
|
+
setLoadingIdentity(false);
|
|
149
|
+
return _context2.finish(18);
|
|
150
|
+
case 21:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context2.stop();
|
|
203
153
|
}
|
|
204
154
|
}, _callee2, null, [[2, 14, 18, 21]]);
|
|
205
155
|
}));
|
|
206
|
-
|
|
207
156
|
return function (_x3) {
|
|
208
157
|
return _ref4.apply(this, arguments);
|
|
209
158
|
};
|
|
@@ -215,8 +164,6 @@ var createAuthentication = function createAuthentication(_ref3) {
|
|
|
215
164
|
onToken: onToken
|
|
216
165
|
}, loadingIdentity ? /*#__PURE__*/_react.default.createElement(_LoggingIn.default, null) : /*#__PURE__*/_react.default.createElement(_SignIn.default, null), /*#__PURE__*/_react.default.createElement(_RequireNewPassword.default, null), /*#__PURE__*/_react.default.createElement(_ForgotPassword.default, null), /*#__PURE__*/_react.default.createElement(_SetNewPassword.default, null), /*#__PURE__*/_react.default.createElement(_SignedIn.default, null, children));
|
|
217
166
|
};
|
|
218
|
-
|
|
219
167
|
return Authentication;
|
|
220
168
|
};
|
|
221
|
-
|
|
222
169
|
exports.createAuthentication = createAuthentication;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createApolloLinkPlugin","ApolloLinkPlugin","setContext","_","headers","Auth","currentSession","user","idToken","getIdToken","Authorization","getJwtToken","defaultOptions","region","appConfig","getKey","process","env","REACT_APP_USER_POOL_REGION","userPoolId","REACT_APP_USER_POOL_ID","userPoolWebClientId","REACT_APP_USER_POOL_WEB_CLIENT_ID","createAuthentication","getIdentityData","onError","config","Object","keys","forEach","key","undefined","configure","Authentication","props","children","useState","loadingIdentity","setLoadingIdentity","useSecurity","setIdentity","client","useApolloClient","onToken","useCallback","token","payload","logout","id","displayName","type","permissions","data","console","log","error","useEffect","plugins","register"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from \"react\";\nimport { Auth } from \"@aws-amplify/auth\";\nimport { AuthOptions } from \"@aws-amplify/auth/lib-esm/types\";\nimport ApolloClient from \"apollo-client\";\nimport { useApolloClient } from \"@apollo/react-hooks\";\nimport { setContext } from \"apollo-link-context\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ApolloLinkPlugin } from \"@webiny/app/plugins/ApolloLinkPlugin\";\nimport { CognitoIdToken } from \"@webiny/app-cognito-authenticator/types\";\nimport { Authenticator } from \"@webiny/app-cognito-authenticator/Authenticator\";\nimport SignIn from \"~/views/SignIn\";\nimport RequireNewPassword from \"~/views/RequireNewPassword\";\nimport ForgotPassword from \"~/views/ForgotPassword\";\nimport SetNewPassword from \"~/views/SetNewPassword\";\nimport SignedIn from \"~/views/SignedIn\";\nimport { useSecurity } from \"@webiny/app-security\";\nimport { config as appConfig } from \"@webiny/app/config\";\nimport LoggingIn from \"~/views/LoggingIn\";\n\nconst createApolloLinkPlugin = (): ApolloLinkPlugin => {\n return new ApolloLinkPlugin(() => {\n return setContext(async (_, { headers }) => {\n const user = await Auth.currentSession();\n const idToken = user.getIdToken();\n\n if (!idToken) {\n return { headers };\n }\n\n // If \"Authorization\" header is already set, don't overwrite it.\n if (headers && headers.Authorization) {\n return { headers };\n }\n\n return {\n headers: {\n ...headers,\n Authorization: `Bearer ${idToken.getJwtToken()}`\n }\n };\n });\n });\n};\n\nconst defaultOptions = {\n region: appConfig.getKey(\"USER_POOL_REGION\", process.env.REACT_APP_USER_POOL_REGION),\n userPoolId: appConfig.getKey(\"USER_POOL_ID\", process.env.REACT_APP_USER_POOL_ID),\n userPoolWebClientId: appConfig.getKey(\n \"USER_POOL_WEB_CLIENT_ID\",\n process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID\n )\n};\n\nexport interface AuthenticationProps {\n children: React.ReactNode;\n}\n\nexport interface AuthenticationFactoryConfig extends AuthOptions {\n onError?(error: Error): void;\n getIdentityData(params: {\n client: ApolloClient<any>;\n payload: { [key: string]: any };\n }): Promise<{ [key: string]: any }>;\n}\n\ninterface AuthenticationFactory {\n (params: AuthenticationFactoryConfig): React.FC<AuthenticationProps>;\n}\nexport const createAuthentication: AuthenticationFactory = ({\n getIdentityData,\n onError,\n ...config\n}) => {\n /**\n * TODO @ts-refactor\n */\n // @ts-ignore\n Object.keys(config).forEach(key => config[key] === undefined && delete config[key]);\n Auth.configure({ ...defaultOptions, ...config });\n\n const Authentication: React.FC<AuthenticationProps> = props => {\n const { children } = props;\n const [loadingIdentity, setLoadingIdentity] = useState(false);\n const { setIdentity } = useSecurity();\n const client = useApolloClient();\n\n const onToken = useCallback(async (token: CognitoIdToken) => {\n const { payload, logout } = token;\n\n setLoadingIdentity(true);\n\n try {\n const { id, displayName, type, permissions, ...data } = await getIdentityData({\n client,\n payload\n });\n\n setIdentity({\n id,\n displayName,\n type,\n permissions,\n ...data,\n logout:\n logout ||\n (() => {\n return void 0;\n })\n });\n } catch (err) {\n console.log(\"ERROR\", err);\n if (typeof onError === \"function\") {\n onError(err);\n } else {\n console.error(err);\n }\n } finally {\n setLoadingIdentity(false);\n }\n }, []);\n\n useEffect(() => {\n plugins.register(createApolloLinkPlugin());\n }, []);\n\n return (\n <Authenticator onToken={onToken}>\n {loadingIdentity ? <LoggingIn /> : <SignIn />}\n <RequireNewPassword />\n <ForgotPassword />\n <SetNewPassword />\n <SignedIn>{children}</SignedIn>\n </Authenticator>\n );\n };\n\n return Authentication;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["createApolloLinkPlugin","ApolloLinkPlugin","setContext","_","headers","Auth","currentSession","user","idToken","getIdToken","Authorization","getJwtToken","defaultOptions","region","appConfig","getKey","process","env","REACT_APP_USER_POOL_REGION","userPoolId","REACT_APP_USER_POOL_ID","userPoolWebClientId","REACT_APP_USER_POOL_WEB_CLIENT_ID","createAuthentication","getIdentityData","onError","config","Object","keys","forEach","key","undefined","configure","Authentication","props","children","useState","loadingIdentity","setLoadingIdentity","useSecurity","setIdentity","client","useApolloClient","onToken","useCallback","token","payload","logout","id","displayName","type","permissions","data","console","log","error","useEffect","plugins","register"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from \"react\";\nimport { Auth } from \"@aws-amplify/auth\";\nimport { AuthOptions } from \"@aws-amplify/auth/lib-esm/types\";\nimport ApolloClient from \"apollo-client\";\nimport { useApolloClient } from \"@apollo/react-hooks\";\nimport { setContext } from \"apollo-link-context\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ApolloLinkPlugin } from \"@webiny/app/plugins/ApolloLinkPlugin\";\nimport { CognitoIdToken } from \"@webiny/app-cognito-authenticator/types\";\nimport { Authenticator } from \"@webiny/app-cognito-authenticator/Authenticator\";\nimport SignIn from \"~/views/SignIn\";\nimport RequireNewPassword from \"~/views/RequireNewPassword\";\nimport ForgotPassword from \"~/views/ForgotPassword\";\nimport SetNewPassword from \"~/views/SetNewPassword\";\nimport SignedIn from \"~/views/SignedIn\";\nimport { useSecurity } from \"@webiny/app-security\";\nimport { config as appConfig } from \"@webiny/app/config\";\nimport LoggingIn from \"~/views/LoggingIn\";\n\nconst createApolloLinkPlugin = (): ApolloLinkPlugin => {\n return new ApolloLinkPlugin(() => {\n return setContext(async (_, { headers }) => {\n const user = await Auth.currentSession();\n const idToken = user.getIdToken();\n\n if (!idToken) {\n return { headers };\n }\n\n // If \"Authorization\" header is already set, don't overwrite it.\n if (headers && headers.Authorization) {\n return { headers };\n }\n\n return {\n headers: {\n ...headers,\n Authorization: `Bearer ${idToken.getJwtToken()}`\n }\n };\n });\n });\n};\n\nconst defaultOptions = {\n region: appConfig.getKey(\"USER_POOL_REGION\", process.env.REACT_APP_USER_POOL_REGION),\n userPoolId: appConfig.getKey(\"USER_POOL_ID\", process.env.REACT_APP_USER_POOL_ID),\n userPoolWebClientId: appConfig.getKey(\n \"USER_POOL_WEB_CLIENT_ID\",\n process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID\n )\n};\n\nexport interface AuthenticationProps {\n children: React.ReactNode;\n}\n\nexport interface AuthenticationFactoryConfig extends AuthOptions {\n onError?(error: Error): void;\n getIdentityData(params: {\n client: ApolloClient<any>;\n payload: { [key: string]: any };\n }): Promise<{ [key: string]: any }>;\n}\n\ninterface AuthenticationFactory {\n (params: AuthenticationFactoryConfig): React.FC<AuthenticationProps>;\n}\nexport const createAuthentication: AuthenticationFactory = ({\n getIdentityData,\n onError,\n ...config\n}) => {\n /**\n * TODO @ts-refactor\n */\n // @ts-ignore\n Object.keys(config).forEach(key => config[key] === undefined && delete config[key]);\n Auth.configure({ ...defaultOptions, ...config });\n\n const Authentication: React.FC<AuthenticationProps> = props => {\n const { children } = props;\n const [loadingIdentity, setLoadingIdentity] = useState(false);\n const { setIdentity } = useSecurity();\n const client = useApolloClient();\n\n const onToken = useCallback(async (token: CognitoIdToken) => {\n const { payload, logout } = token;\n\n setLoadingIdentity(true);\n\n try {\n const { id, displayName, type, permissions, ...data } = await getIdentityData({\n client,\n payload\n });\n\n setIdentity({\n id,\n displayName,\n type,\n permissions,\n ...data,\n logout:\n logout ||\n (() => {\n return void 0;\n })\n });\n } catch (err) {\n console.log(\"ERROR\", err);\n if (typeof onError === \"function\") {\n onError(err);\n } else {\n console.error(err);\n }\n } finally {\n setLoadingIdentity(false);\n }\n }, []);\n\n useEffect(() => {\n plugins.register(createApolloLinkPlugin());\n }, []);\n\n return (\n <Authenticator onToken={onToken}>\n {loadingIdentity ? <LoggingIn /> : <SignIn />}\n <RequireNewPassword />\n <ForgotPassword />\n <SetNewPassword />\n <SignedIn>{children}</SignedIn>\n </Authenticator>\n );\n };\n\n return Authentication;\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAA0C;EAAA;AAE1C,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsB,GAA2B;EACnD,OAAO,IAAIC,kCAAgB,CAAC,YAAM;IAC9B,OAAO,IAAAC,6BAAU;MAAA,mGAAC,iBAAOC,CAAC;QAAA;QAAA;UAAA;YAAA;cAAIC,OAAO,QAAPA,OAAO;cAAA;cAAA,OACdC,UAAI,CAACC,cAA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MAAA;QAAA;MAAA;IAAA,KAAE,EAAE,CAAC;IAEN,IAAAkB,gBAAS,EAAC,YAAM;MACZC,gBAAO,CAACC,QAAQ,CAAC1D,sBAAsB,EAAE,CAAC;IAC9C,CAAC,EAAE,EAAE,CAAC;IAEN,oBACI,6BAAC,4BAAa;MAAC,OAAO,EAAE2C;IAAQ,GAC3BN,eAAe,gBAAG,6BAAC,kBAAS,OAAG,gBAAG,6BAAC,eAAM,OAAG,eAC7C,6BAAC,2BAAkB,OAAG,eACtB,6BAAC,uBAAc,OAAG,eAClB,6BAAC,uBAAc,OAAG,eAClB,6BAAC,iBAAQ,QAAEF,QAAQ,CAAY,CACnB;EAExB,CAAC;EAED,OAAOF,cAAc;AACzB,CAAC;AAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-admin-cognito",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.35.0-beta.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@apollo/react-hooks": "3.1.5",
|
|
16
|
-
"@aws-amplify/auth": "
|
|
17
|
-
"@emotion/styled": "10.
|
|
18
|
-
"@webiny/app": "5.
|
|
19
|
-
"@webiny/app-admin": "5.
|
|
20
|
-
"@webiny/app-cognito-authenticator": "5.
|
|
21
|
-
"@webiny/app-security": "5.
|
|
22
|
-
"@webiny/form": "5.
|
|
23
|
-
"@webiny/plugins": "5.
|
|
24
|
-
"@webiny/ui": "5.
|
|
25
|
-
"@webiny/validation": "5.
|
|
16
|
+
"@aws-amplify/auth": "5.1.9",
|
|
17
|
+
"@emotion/styled": "11.10.6",
|
|
18
|
+
"@webiny/app": "5.35.0-beta.1",
|
|
19
|
+
"@webiny/app-admin": "5.35.0-beta.1",
|
|
20
|
+
"@webiny/app-cognito-authenticator": "5.35.0-beta.1",
|
|
21
|
+
"@webiny/app-security": "5.35.0-beta.1",
|
|
22
|
+
"@webiny/form": "5.35.0-beta.1",
|
|
23
|
+
"@webiny/plugins": "5.35.0-beta.1",
|
|
24
|
+
"@webiny/ui": "5.35.0-beta.1",
|
|
25
|
+
"@webiny/validation": "5.35.0-beta.1",
|
|
26
26
|
"apollo-client": "2.6.10",
|
|
27
27
|
"apollo-link-context": "1.0.20",
|
|
28
28
|
"emotion": "10.0.27",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@babel/preset-env": "^7.19.4",
|
|
38
38
|
"@babel/preset-react": "^7.16.0",
|
|
39
39
|
"@babel/preset-typescript": "^7.18.6",
|
|
40
|
-
"@webiny/cli": "^5.
|
|
41
|
-
"@webiny/project-utils": "^5.
|
|
40
|
+
"@webiny/cli": "^5.35.0-beta.1",
|
|
41
|
+
"@webiny/project-utils": "^5.35.0-beta.1",
|
|
42
42
|
"babel-plugin-lodash": "^3.3.4",
|
|
43
43
|
"rimraf": "^3.0.2",
|
|
44
44
|
"ttypescript": "^1.5.12",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
]
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "6b376faedf02e056efbbf1e4d46d537850773ce0"
|
|
63
63
|
}
|
package/views/ForgotPassword.js
CHANGED
|
@@ -1,63 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
|
-
|
|
12
9
|
var React = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _form = require("@webiny/form");
|
|
15
|
-
|
|
16
11
|
var _validation = require("@webiny/validation");
|
|
17
|
-
|
|
18
12
|
var _Button = require("@webiny/ui/Button");
|
|
19
|
-
|
|
20
13
|
var _Input = require("@webiny/ui/Input");
|
|
21
|
-
|
|
22
14
|
var _Grid = require("@webiny/ui/Grid");
|
|
23
|
-
|
|
24
15
|
var _Typography = require("@webiny/ui/Typography");
|
|
25
|
-
|
|
26
16
|
var _Alert = require("@webiny/ui/Alert");
|
|
27
|
-
|
|
28
17
|
var _Elevation = require("@webiny/ui/Elevation");
|
|
29
|
-
|
|
30
18
|
var _StateContainer = _interopRequireDefault(require("./StateContainer"));
|
|
31
|
-
|
|
32
19
|
var _StyledComponents = require("./StyledComponents");
|
|
33
|
-
|
|
34
20
|
var _Progress = require("@webiny/ui/Progress");
|
|
35
|
-
|
|
36
21
|
var _useAuthenticator2 = require("@webiny/app-cognito-authenticator/hooks/useAuthenticator");
|
|
37
|
-
|
|
38
22
|
var _useForgotPassword2 = require("@webiny/app-cognito-authenticator/hooks/useForgotPassword");
|
|
39
|
-
|
|
40
23
|
var ForgotPassword = function ForgotPassword() {
|
|
41
24
|
var _useAuthenticator = (0, _useAuthenticator2.useAuthenticator)(),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
25
|
+
authData = _useAuthenticator.authData,
|
|
26
|
+
changeState = _useAuthenticator.changeState;
|
|
45
27
|
var _useForgotPassword = (0, _useForgotPassword2.useForgotPassword)(),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
28
|
+
loading = _useForgotPassword.loading,
|
|
29
|
+
codeSent = _useForgotPassword.codeSent,
|
|
30
|
+
shouldRender = _useForgotPassword.shouldRender,
|
|
31
|
+
setPassword = _useForgotPassword.setPassword,
|
|
32
|
+
requestCode = _useForgotPassword.requestCode,
|
|
33
|
+
error = _useForgotPassword.error;
|
|
53
34
|
if (!shouldRender) {
|
|
54
35
|
return null;
|
|
55
36
|
}
|
|
56
|
-
|
|
57
37
|
var _ref = authData || {},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
38
|
+
_ref$username = _ref.username,
|
|
39
|
+
username = _ref$username === void 0 ? "" : _ref$username;
|
|
61
40
|
return /*#__PURE__*/React.createElement(_StateContainer.default, null, /*#__PURE__*/React.createElement(_form.Form, {
|
|
62
41
|
data: {
|
|
63
42
|
username: username
|
|
@@ -73,8 +52,8 @@ var ForgotPassword = function ForgotPassword() {
|
|
|
73
52
|
submitOnEnter: true
|
|
74
53
|
}, function (_ref3) {
|
|
75
54
|
var Bind = _ref3.Bind,
|
|
76
|
-
|
|
77
|
-
|
|
55
|
+
submit = _ref3.submit,
|
|
56
|
+
data = _ref3.data;
|
|
78
57
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Elevation.Elevation, {
|
|
79
58
|
z: 2
|
|
80
59
|
}, /*#__PURE__*/React.createElement(_StyledComponents.InnerContent, null, loading && /*#__PURE__*/React.createElement(_Progress.CircularProgress, null), /*#__PURE__*/React.createElement(_StyledComponents.Title, null, /*#__PURE__*/React.createElement("h1", null, /*#__PURE__*/React.createElement(_Typography.Typography, {
|
|
@@ -135,6 +114,5 @@ var ForgotPassword = function ForgotPassword() {
|
|
|
135
114
|
}, "Sign in"))));
|
|
136
115
|
}));
|
|
137
116
|
};
|
|
138
|
-
|
|
139
117
|
var _default = ForgotPassword;
|
|
140
118
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ForgotPassword","useAuthenticator","authData","changeState","useForgotPassword","loading","codeSent","shouldRender","setPassword","requestCode","error","username","Bind","submit","data","validation","create","val","cb","toLowerCase","alignRight","ev","textAlign"],"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: React.FC = () => {\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;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,cAAwB,GAAG,SAA3BA,cAA2B,GAAM;EACnC,wBAAkC,IAAAC,mCAAA,GAAlC;EAAA,IAAQC,QAAR,qBAAQA,QAAR;EAAA,IAAkBC,WAAlB,qBAAkBA,WAAlB;;EACA,yBACI,IAAAC,qCAAA,GADJ;EAAA,IAAQC,OAAR,sBAAQA,OAAR;EAAA,IAAiBC,QAAjB,sBAAiBA,QAAjB;EAAA,IAA2BC,YAA3B,sBAA2BA,YAA3B;EAAA,IAAyCC,WAAzC,sBAAyCA,WAAzC;EAAA,IAAsDC,WAAtD,sBAAsDA,WAAtD;EAAA,IAAmEC,KAAnE,sBAAmEA,KAAnE;;EAGA,IAAI,CAACH,YAAL,EAAmB;IACf,OAAO,IAAP;EACH;;EAED,WAA0BL,QAAQ,IAAI,EAAtC;EAAA,yBAAQS,QAAR;EAAA,IAAQA,QAAR,8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
|
+
{"version":3,"names":["ForgotPassword","useAuthenticator","authData","changeState","useForgotPassword","loading","codeSent","shouldRender","setPassword","requestCode","error","username","Bind","submit","data","validation","create","val","cb","toLowerCase","alignRight","ev","textAlign"],"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: React.FC = () => {\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,IAAMA,cAAwB,GAAG,SAA3BA,cAAwB,GAAS;EACnC,wBAAkC,IAAAC,mCAAgB,GAAE;IAA5CC,QAAQ,qBAARA,QAAQ;IAAEC,WAAW,qBAAXA,WAAW;EAC7B,yBACI,IAAAC,qCAAiB,GAAE;IADfC,OAAO,sBAAPA,OAAO;IAAEC,QAAQ,sBAARA,QAAQ;IAAEC,YAAY,sBAAZA,YAAY;IAAEC,WAAW,sBAAXA,WAAW;IAAEC,WAA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AC,SAEpD,CAAI,CACD,CACJ,CACR;EAAA,CACN,CACE,CACM;AAEzB,CAAC;AAAC,eAEaH,cAAc;AAAA"}
|
package/views/LoggingIn.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _Progress = require("@webiny/ui/Progress");
|
|
13
|
-
|
|
14
10
|
var LoggingIn = function LoggingIn() {
|
|
15
11
|
return /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, {
|
|
16
12
|
label: "Loading identity..."
|
|
17
13
|
});
|
|
18
14
|
};
|
|
19
|
-
|
|
20
15
|
var _default = LoggingIn;
|
|
21
16
|
exports.default = _default;
|
package/views/LoggingIn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LoggingIn"],"sources":["LoggingIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\n\nconst LoggingIn: React.FC = () => {\n return <CircularProgress label={\"Loading identity...\"} />;\n};\n\nexport default LoggingIn;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["LoggingIn"],"sources":["LoggingIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\n\nconst LoggingIn: React.FC = () => {\n return <CircularProgress label={\"Loading identity...\"} />;\n};\n\nexport default LoggingIn;\n"],"mappings":";;;;;;;AAAA;AACA;AAEA,IAAMA,SAAmB,GAAG,SAAtBA,SAAmB,GAAS;EAC9B,oBAAO,6BAAC,0BAAgB;IAAC,KAAK,EAAE;EAAsB,EAAG;AAC7D,CAAC;AAAC,eAEaA,SAAS;AAAA"}
|
|
@@ -1,53 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _form = require("@webiny/form");
|
|
13
|
-
|
|
14
10
|
var _validation = require("@webiny/validation");
|
|
15
|
-
|
|
16
11
|
var _Button = require("@webiny/ui/Button");
|
|
17
|
-
|
|
18
12
|
var _Input = require("@webiny/ui/Input");
|
|
19
|
-
|
|
20
13
|
var _Grid = require("@webiny/ui/Grid");
|
|
21
|
-
|
|
22
14
|
var _Typography = require("@webiny/ui/Typography");
|
|
23
|
-
|
|
24
15
|
var _Elevation = require("@webiny/ui/Elevation");
|
|
25
|
-
|
|
26
16
|
var _useRequireNewPassword = require("@webiny/app-cognito-authenticator/hooks/useRequireNewPassword");
|
|
27
|
-
|
|
28
17
|
var _StateContainer = _interopRequireDefault(require("./StateContainer"));
|
|
29
|
-
|
|
30
18
|
var _StyledComponents = require("./StyledComponents");
|
|
31
|
-
|
|
32
19
|
var sentenceCase = function sentenceCase(str) {
|
|
33
20
|
var lower = str.toLowerCase();
|
|
34
21
|
return lower[0].toUpperCase() + lower.substring(1);
|
|
35
22
|
};
|
|
36
|
-
|
|
37
23
|
var RequireNewPassword = function RequireNewPassword() {
|
|
38
24
|
var _useRequireNewPasswor = (0, _useRequireNewPassword.useRequireNewPassword)(),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
shouldRender = _useRequireNewPasswor.shouldRender,
|
|
26
|
+
requiredAttributes = _useRequireNewPasswor.requiredAttributes,
|
|
27
|
+
confirm = _useRequireNewPasswor.confirm;
|
|
43
28
|
if (!shouldRender) {
|
|
44
29
|
return null;
|
|
45
30
|
}
|
|
46
|
-
|
|
47
31
|
return /*#__PURE__*/_react.default.createElement(_StateContainer.default, null, /*#__PURE__*/_react.default.createElement(_form.Form, {
|
|
48
32
|
onSubmit: function onSubmit(_ref) {
|
|
49
33
|
var password = _ref.password,
|
|
50
|
-
|
|
34
|
+
requiredAttributes = _ref.requiredAttributes;
|
|
51
35
|
return confirm({
|
|
52
36
|
password: password,
|
|
53
37
|
requiredAttributes: requiredAttributes
|
|
@@ -56,7 +40,7 @@ var RequireNewPassword = function RequireNewPassword() {
|
|
|
56
40
|
submitOnEnter: true
|
|
57
41
|
}, function (_ref2) {
|
|
58
42
|
var Bind = _ref2.Bind,
|
|
59
|
-
|
|
43
|
+
submit = _ref2.submit;
|
|
60
44
|
return /*#__PURE__*/_react.default.createElement(_Elevation.Elevation, {
|
|
61
45
|
z: 2
|
|
62
46
|
}, /*#__PURE__*/_react.default.createElement(_StyledComponents.InnerContent, null, /*#__PURE__*/_react.default.createElement(_StyledComponents.Title, null, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
|
|
@@ -94,6 +78,5 @@ var RequireNewPassword = function RequireNewPassword() {
|
|
|
94
78
|
}, "Set password")))));
|
|
95
79
|
}));
|
|
96
80
|
};
|
|
97
|
-
|
|
98
81
|
var _default = RequireNewPassword;
|
|
99
82
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sentenceCase","str","lower","toLowerCase","toUpperCase","substring","RequireNewPassword","useRequireNewPassword","shouldRender","requiredAttributes","confirm","password","Bind","submit","validation","create","length","map","name","alignRight","ev"],"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 { Elevation } from \"@webiny/ui/Elevation\";\nimport { useRequireNewPassword } from \"@webiny/app-cognito-authenticator/hooks/useRequireNewPassword\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, InnerContent, Title } from \"./StyledComponents\";\n\nconst sentenceCase = (str: string) => {\n const lower = str.toLowerCase();\n return lower[0].toUpperCase() + lower.substring(1);\n};\n\nconst RequireNewPassword: React.FC = () => {\n const { shouldRender, requiredAttributes, confirm } = useRequireNewPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <StateContainer>\n <Form\n onSubmit={({ password, requiredAttributes }) =>\n confirm({ password, requiredAttributes })\n }\n submitOnEnter\n >\n {({ Bind, submit }) => (\n <Elevation z={2}>\n <InnerContent>\n <Title>\n <Typography use=\"headline4\">Set New Password</Typography>\n </Title>\n\n <Grid>\n <Cell span={12}>\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\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\n name={name}\n validators={validation.create(\"required\")}\n >\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 </InnerContent>\n </Elevation>\n )}\n </Form>\n </StateContainer>\n );\n};\n\nexport default RequireNewPassword;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["sentenceCase","str","lower","toLowerCase","toUpperCase","substring","RequireNewPassword","useRequireNewPassword","shouldRender","requiredAttributes","confirm","password","Bind","submit","validation","create","length","map","name","alignRight","ev"],"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 { Elevation } from \"@webiny/ui/Elevation\";\nimport { useRequireNewPassword } from \"@webiny/app-cognito-authenticator/hooks/useRequireNewPassword\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, InnerContent, Title } from \"./StyledComponents\";\n\nconst sentenceCase = (str: string) => {\n const lower = str.toLowerCase();\n return lower[0].toUpperCase() + lower.substring(1);\n};\n\nconst RequireNewPassword: React.FC = () => {\n const { shouldRender, requiredAttributes, confirm } = useRequireNewPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <StateContainer>\n <Form\n onSubmit={({ password, requiredAttributes }) =>\n confirm({ password, requiredAttributes })\n }\n submitOnEnter\n >\n {({ Bind, submit }) => (\n <Elevation z={2}>\n <InnerContent>\n <Title>\n <Typography use=\"headline4\">Set New Password</Typography>\n </Title>\n\n <Grid>\n <Cell span={12}>\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\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\n name={name}\n validators={validation.create(\"required\")}\n >\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 </InnerContent>\n </Elev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,YAAK;MACF,IAAI,EAAE,UAAW;MACjB,KAAK,EAAE,cAAe;MACtB,QAAQ,EAAE;IAAK,EACjB,CACC,CACJ,CACJ,EACNN,kBAAkB,CAACO,MAAM,GAAG,CAAC,iBAC1B,6BAAC,uBAAK,qBACF,6BAAC,sBAAU;MAAC,GAAG,EAAC;IAAW,GAAC,qCAE5B,CAAa,CAEpB,eACD,6BAAC,UAAI,QACAP,kBAAkB,CAACQ,GAAG,CAAC,UAAAC,IAAI;MAAA,oBACxB,6BAAC,UAAI;QAAC,GAAG,EAAEA,IAAK;QAAC,IAAI,EAAE;MAAG,gBACtB,6BAAC,IAAI;QACD,IAAI,EAAEA,IAAK;QACX,UAAU,EAAEJ,sBAAU,CAACC,MAAM,CAAC,UAAU;MAAE,gBAE1C,6BAAC,YAAK;QAAC,KAAK,EAAEf,YAAY,CAACkB,IAAI,CAAE;QAAC,QAAQ,EAAE;MAAK,EAAG,CACjD,CACJ;IAAA,CACV,CAAC,CACC,eAEP,6BAAC,UAAI,qBACD,6BAAC,UAAI;MAAC,IAAI,EAAE,EAAG;MAAC,SAAS,EAAEC;IAAW,gBAClC,6BAAC,qBAAa;MACV,eAAY,4BAA4B;MACxC,OAAO,EAAE,iBAAAC,EAAE,EAAI;QACXP,MAAM,CAACO,EAAE,CAAC;MACd;IAAE,GAED,cAAc,CACH,CACb,CACJ,CACI,CACP;EAAA,CACf,CACE,CACM;AAEzB,CAAC;AAAC,eAEad,kBAAkB;AAAA"}
|
package/views/SetNewPassword.js
CHANGED
|
@@ -1,52 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _form = require("@webiny/form");
|
|
13
|
-
|
|
14
10
|
var _validation = require("@webiny/validation");
|
|
15
|
-
|
|
16
11
|
var _Button = require("@webiny/ui/Button");
|
|
17
|
-
|
|
18
12
|
var _Input = require("@webiny/ui/Input");
|
|
19
|
-
|
|
20
13
|
var _Grid = require("@webiny/ui/Grid");
|
|
21
|
-
|
|
22
14
|
var _Typography = require("@webiny/ui/Typography");
|
|
23
|
-
|
|
24
15
|
var _Elevation = require("@webiny/ui/Elevation");
|
|
25
|
-
|
|
26
16
|
var _Progress = require("@webiny/ui/Progress");
|
|
27
|
-
|
|
28
17
|
var _StateContainer = _interopRequireDefault(require("./StateContainer"));
|
|
29
|
-
|
|
30
18
|
var _StyledComponents = require("./StyledComponents");
|
|
31
|
-
|
|
32
19
|
var _useAuthenticator2 = require("@webiny/app-cognito-authenticator/hooks/useAuthenticator");
|
|
33
|
-
|
|
34
20
|
var _useSetNewPassword2 = require("@webiny/app-cognito-authenticator/hooks/useSetNewPassword");
|
|
35
|
-
|
|
36
21
|
var SetNewPassword = function SetNewPassword() {
|
|
37
22
|
var _useAuthenticator = (0, _useAuthenticator2.useAuthenticator)(),
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
changeState = _useAuthenticator.changeState;
|
|
40
24
|
var _useSetNewPassword = (0, _useSetNewPassword2.useSetNewPassword)(),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
shouldRender = _useSetNewPassword.shouldRender,
|
|
26
|
+
setPassword = _useSetNewPassword.setPassword,
|
|
27
|
+
error = _useSetNewPassword.error,
|
|
28
|
+
loading = _useSetNewPassword.loading;
|
|
46
29
|
if (!shouldRender) {
|
|
47
30
|
return null;
|
|
48
31
|
}
|
|
49
|
-
|
|
50
32
|
return /*#__PURE__*/_react.default.createElement(_StateContainer.default, null, /*#__PURE__*/_react.default.createElement(_form.Form, {
|
|
51
33
|
onSubmit: function onSubmit(data) {
|
|
52
34
|
/**
|
|
@@ -57,15 +39,13 @@ var SetNewPassword = function SetNewPassword() {
|
|
|
57
39
|
submitOnEnter: true
|
|
58
40
|
}, function (_ref) {
|
|
59
41
|
var Bind = _ref.Bind,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
42
|
+
submit = _ref.submit,
|
|
43
|
+
data = _ref.data;
|
|
63
44
|
var retypePasswordValidator = function retypePasswordValidator(value) {
|
|
64
45
|
if (value !== data.password) {
|
|
65
46
|
throw Error("Passwords do not match!");
|
|
66
47
|
}
|
|
67
48
|
};
|
|
68
|
-
|
|
69
49
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Elevation.Elevation, {
|
|
70
50
|
z: 2
|
|
71
51
|
}, /*#__PURE__*/_react.default.createElement(_StyledComponents.InnerContent, null, loading && /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, null), /*#__PURE__*/_react.default.createElement(_StyledComponents.Title, null, /*#__PURE__*/_react.default.createElement("h1", null, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
|
|
@@ -128,6 +108,5 @@ var SetNewPassword = function SetNewPassword() {
|
|
|
128
108
|
}, "Sign in"))));
|
|
129
109
|
}));
|
|
130
110
|
};
|
|
131
|
-
|
|
132
111
|
var _default = SetNewPassword;
|
|
133
112
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SetNewPassword","useAuthenticator","changeState","useSetNewPassword","shouldRender","setPassword","error","loading","data","Bind","submit","retypePasswordValidator","value","password","Error","errorMessage","validation","create","alignRight","ev","textAlign"],"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: React.FC = () => {\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;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA,IAAMA,cAAwB,GAAG,SAA3BA,cAA2B,GAAM;EACnC,wBAAwB,IAAAC,mCAAA,GAAxB;EAAA,IAAQC,WAAR,qBAAQA,WAAR;;EACA,yBAAsD,IAAAC,qCAAA,GAAtD;EAAA,IAAQC,YAAR,sBAAQA,YAAR;EAAA,IAAsBC,WAAtB,sBAAsBA,WAAtB;EAAA,IAAmCC,KAAnC,sBAAmCA,KAAnC;EAAA,IAA0CC,OAA1C,sBAA0CA,OAA1C;;EAEA,IAAI,CAACH,YAAL,EAAmB;IACf,OAAO,IAAP;EACH;;EAED,oBACI,6BAAC,uBAAD,qBACI,6BAAC,UAAD;IACI,QAAQ,EAAE,kBAAAI,IAAI,EAAI;MACd;AACpB;AACA;MACoB,OAAOH,WAAW,CAACG,IAAD,CAAlB;IACH,CANL;IAOI,aAAa;EAPjB,GASK,gBAA4B;IAAA,IAAzBC,IAAyB,QAAzBA,IAAyB;IAAA,IAAnBC,MAAmB,QAAnBA,MAAmB;IAAA,IAAXF,IAAW,QAAXA,IAAW;;IACzB,IAAMG,uBAAuB,GAAG,SAA1BA,uBAA0B,CAACC,KAAD,EAAmB;MAC/C,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D,sBAAA,CAAWC,MAAX,CAAkB,UAAlB,CADQ,EAERN,uBAFQ;IAFhB,gBAOI,6BAAC,YAAD;MACI,IAAI,EAAE,UADV;MAEI,KAAK,EAAE,iBAFX;MAGI,QAAQ,EAAE,IAHd;MAII,WAAW,EACP;IALR,EAPJ,CADJ,CA9BJ,eAgDI,6BAAC,UAAD;MAAM,IAAI,EAAE,EAAZ;MAAgB,SAAS,EAAEO;IAA3B,gBACI,6BAAC,qBAAD;MACI,eAAY,oBADhB;MAEI,OAAO,EAAE,iBAAAC,EAAE,EAAI;QACXT,MAAM,CAACS,EAAD,CAAN;MACH;IAJL,GAMK,kBANL,CADJ,CAhDJ,CAlBJ,CADJ,CADJ,eAiFI,6BAAC,UAAD,qBACI,6BAAC,UAAD;MAAM,IAAI,EAAE,EAAZ;MAAgB,KAAK,EAAE;QAAEC,SAAS,EAAE;MAAb;IAAvB,GAAgD,mBAAhD,eAEI;MAAG,IAAI,EAAE,GAAT;MAAc,OAAO,EAAE;QAAA,OAAMlB,WAAW,CAAC,QAAD,CAAjB;MAAA;IAAvB,GAAoD,SAApD,CAFJ,CADJ,CAjFJ,CADJ;EA4FH,CA5GL,CADJ,CADJ;AAkHH,CA1HD;;eA4HeF,c"}
|
|
1
|
+
{"version":3,"names":["SetNewPassword","useAuthenticator","changeState","useSetNewPassword","shouldRender","setPassword","error","loading","data","Bind","submit","retypePasswordValidator","value","password","Error","errorMessage","validation","create","alignRight","ev","textAlign"],"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: React.FC = () => {\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA,IAAMA,cAAwB,GAAG,SAA3BA,cAAwB,GAAS;EACnC,wBAAwB,IAAAC,mCAAgB,GAAE;IAAlCC,WAAW,qBAAXA,WAAW;EACnB,yBAAsD,IAAAC,qCAAiB,GAAE;IAAjEC,YAAY,sBAAZA,YAAY;IAAEC,WAAW,sBAAXA,WAAW;IAAEC,KAAK,sBAALA,KAAK;IAAEC,OAAO,sBAAPA,OAAO;EAEjD,IAAI,CAACH,YAAY,EAAE;IACf,OAAO,IAAI;EACf;EAEA,oBACI,6BAAC,uBAAc,qBACX,6BAAC,UAAI;IACD,QAAQ,EAAE,kBAAAI,IAAI,EAAI;MACd;AACpB;AACA;MACoB,OAAOH,WAAW,CAACG,IAAI,CAA+C;IAC1E,CAAE;IACF,aAAa;EAAA,GAEZ,gBAA4B;IAAA,IAAzBC,IAAI,QAAJA,IAAI;MAAEC,MAAM,QAANA,MAAM;MAAEF,IAAI,QAAJA,IAAI;IAClB,IAAMG,uBAAuB,GAAG,SAA1BA,uBAAuB,CAAIC,KAAa,EAAK;MAC/C,IAAIA,KAAK,KAAKJ,IAAI,CAACK,QAAQ,EAAE;QACzB,MAAMC,KAAK,CAAC,yBAAyB,CAAC;MAC1C;IACJ,CAAC;IAED,oBACI,yEACI,6BAAC,oBAAS;MAAC,CAAC,EAAE;IAAE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EACH,CACC,CACJ,eACP,6BAAC,UAAI;MAAC,IAAI,EAAE,EAAG;MAAC,SAAS,EAAEO;IAAW,gBAClC,6BAAC,qBAAa;MACV,eAAY,oBAAoB;MAChC,OAAO,EAAE,iBAAAC,EAAE,EAAI;QACXT,MAAM,CAACS,EAAE,CAAC;MACd;IAAE,GAED,kBAAkB,CACP,CACb,CACJ,CACI,CACP,eACZ,6BAAC,UAAI,qBACD,6BAAC,UAAI;MAAC,IAAI,EAAE,EAAG;MAAC,KAAK,EAAE;QAAEC,SAAS,EAAE;MAAS;IAAE,GAAC,mBAC3B,eACjB;MAAG,IAAI,EAAE,GAAI;MAAC,OAAO,EAAE;QAAA,OAAMlB,WAAW,CAAC,QAAQ,CAAC;MAAA;IAAC,GAAC,SAEpD,CAAI,CACD,CACJ,CACR;EAEX,CAAC,CACE,CACM;AAEzB,CAAC;AAAC,eAEaF,cAAc;AAAA"}
|
package/views/SignIn.js
CHANGED
|
@@ -1,55 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _form = require("@webiny/form");
|
|
13
|
-
|
|
14
10
|
var _validation = require("@webiny/validation");
|
|
15
|
-
|
|
16
11
|
var _Button = require("@webiny/ui/Button");
|
|
17
|
-
|
|
18
12
|
var _Input = require("@webiny/ui/Input");
|
|
19
|
-
|
|
20
13
|
var _Grid = require("@webiny/ui/Grid");
|
|
21
|
-
|
|
22
14
|
var _Typography = require("@webiny/ui/Typography");
|
|
23
|
-
|
|
24
15
|
var _Elevation = require("@webiny/ui/Elevation");
|
|
25
|
-
|
|
26
16
|
var _Alert = require("@webiny/ui/Alert");
|
|
27
|
-
|
|
28
17
|
var _Progress = require("@webiny/ui/Progress");
|
|
29
|
-
|
|
30
18
|
var _useAuthenticator2 = require("@webiny/app-cognito-authenticator/hooks/useAuthenticator");
|
|
31
|
-
|
|
32
19
|
var _useSignIn2 = require("@webiny/app-cognito-authenticator/hooks/useSignIn");
|
|
33
|
-
|
|
34
20
|
var _StateContainer = _interopRequireDefault(require("./StateContainer"));
|
|
35
|
-
|
|
36
21
|
var _StyledComponents = require("./StyledComponents");
|
|
37
|
-
|
|
38
22
|
var SignIn = function SignIn() {
|
|
39
23
|
var _useAuthenticator = (0, _useAuthenticator2.useAuthenticator)(),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
message = _useAuthenticator.message,
|
|
25
|
+
changeState = _useAuthenticator.changeState;
|
|
43
26
|
var _useSignIn = (0, _useSignIn2.useSignIn)(),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
signIn = _useSignIn.signIn,
|
|
28
|
+
loading = _useSignIn.loading,
|
|
29
|
+
error = _useSignIn.error,
|
|
30
|
+
shouldRender = _useSignIn.shouldRender;
|
|
49
31
|
if (!shouldRender) {
|
|
50
32
|
return null;
|
|
51
33
|
}
|
|
52
|
-
|
|
53
34
|
return /*#__PURE__*/_react.default.createElement(_StateContainer.default, null, /*#__PURE__*/_react.default.createElement(_form.Form, {
|
|
54
35
|
onSubmit: function onSubmit(data) {
|
|
55
36
|
/**
|
|
@@ -60,7 +41,7 @@ var SignIn = function SignIn() {
|
|
|
60
41
|
submitOnEnter: true
|
|
61
42
|
}, function (_ref) {
|
|
62
43
|
var Bind = _ref.Bind,
|
|
63
|
-
|
|
44
|
+
submit = _ref.submit;
|
|
64
45
|
return /*#__PURE__*/_react.default.createElement(_Elevation.Elevation, {
|
|
65
46
|
z: 2
|
|
66
47
|
}, /*#__PURE__*/_react.default.createElement(_StyledComponents.InnerContent, null, loading && /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, {
|
|
@@ -115,6 +96,5 @@ var SignIn = function SignIn() {
|
|
|
115
96
|
}, "Forgot password?")))));
|
|
116
97
|
}));
|
|
117
98
|
};
|
|
118
|
-
|
|
119
99
|
var _default = SignIn;
|
|
120
100
|
exports.default = _default;
|
package/views/SignIn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SignIn","useAuthenticator","message","changeState","useSignIn","signIn","loading","error","shouldRender","data","Bind","submit","title","type","text","errorMessage","validation","create","val","cb","toLowerCase","alignRight","ev","alignCenter"],"sources":["SignIn.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 { Alert } from \"@webiny/ui/Alert\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport {\n useSignIn,\n UseSignInCallableParams\n} from \"@webiny/app-cognito-authenticator/hooks/useSignIn\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, alignCenter, InnerContent, Title, errorMessage } from \"./StyledComponents\";\n\nconst SignIn: React.FC = () => {\n const { message, changeState } = useAuthenticator();\n const { signIn, loading, error, shouldRender } = useSignIn();\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 UseSignInCallableParams\n */\n return signIn(data as unknown as UseSignInCallableParams);\n }}\n submitOnEnter\n >\n {({ Bind, submit }) => (\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress label={\"Signing in...\"} />}\n <Title>\n <h1>\n <Typography use=\"headline4\">Sign In</Typography>\n </h1>\n </Title>\n\n {message && !error && (\n <Grid>\n <Cell span={12}>\n <Alert title={message.title} type={message.type}>\n {message.text}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n {error && (\n <Grid>\n <Cell span={12} className={errorMessage}>\n <Alert title=\"Authentication error\" type={\"danger\"}>\n {error.message}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n <Grid>\n <Cell 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={\"Your e-mail\"} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input type={\"password\"} label={\"Your password\"} />\n </Bind>\n </Cell>\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 {\"Submit\"}\n </ButtonPrimary>\n </Cell>\n <Cell span={12} className={alignCenter}>\n <a href=\"#\" onClick={() => changeState(\"forgotPassword\")}>\n Forgot password?\n </a>\n </Cell>\n </Grid>\n </InnerContent>\n </Elevation>\n )}\n </Form>\n </StateContainer>\n );\n};\n\nexport default SignIn;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["SignIn","useAuthenticator","message","changeState","useSignIn","signIn","loading","error","shouldRender","data","Bind","submit","title","type","text","errorMessage","validation","create","val","cb","toLowerCase","alignRight","ev","alignCenter"],"sources":["SignIn.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 { Alert } from \"@webiny/ui/Alert\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport {\n useSignIn,\n UseSignInCallableParams\n} from \"@webiny/app-cognito-authenticator/hooks/useSignIn\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, alignCenter, InnerContent, Title, errorMessage } from \"./StyledComponents\";\n\nconst SignIn: React.FC = () => {\n const { message, changeState } = useAuthenticator();\n const { signIn, loading, error, shouldRender } = useSignIn();\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 UseSignInCallableParams\n */\n return signIn(data as unknown as UseSignInCallableParams);\n }}\n submitOnEnter\n >\n {({ Bind, submit }) => (\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress label={\"Signing in...\"} />}\n <Title>\n <h1>\n <Typography use=\"headline4\">Sign In</Typography>\n </h1>\n </Title>\n\n {message && !error && (\n <Grid>\n <Cell span={12}>\n <Alert title={message.title} type={message.type}>\n {message.text}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n {error && (\n <Grid>\n <Cell span={12} className={errorMessage}>\n <Alert title=\"Authentication error\" type={\"danger\"}>\n {error.message}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n <Grid>\n <Cell 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={\"Your e-mail\"} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input type={\"password\"} label={\"Your password\"} />\n </Bind>\n </Cell>\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 {\"Submit\"}\n </ButtonPrimary>\n </Cell>\n <Cell span={12} className={alignCenter}>\n <a href=\"#\" onClick={() => changeState(\"forgotPassword\")}>\n Forgot password?\n </a>\n </Cell>\n </Grid>\n </InnerContent>\n </Elevation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
@@ -4,17 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _useSignedIn2 = require("@webiny/app-cognito-authenticator/hooks/useSignedIn");
|
|
9
|
-
|
|
10
8
|
var SignedIn = function SignedIn(_ref) {
|
|
11
9
|
var children = _ref.children;
|
|
12
|
-
|
|
13
10
|
var _useSignedIn = (0, _useSignedIn2.useSignedIn)(),
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
shouldRender = _useSignedIn.shouldRender;
|
|
16
12
|
return shouldRender ? children : null;
|
|
17
13
|
};
|
|
18
|
-
|
|
19
14
|
var _default = SignedIn;
|
|
20
15
|
exports.default = _default;
|
package/views/SignedIn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SignedIn","children","useSignedIn","shouldRender"],"sources":["SignedIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { useSignedIn } from \"@webiny/app-cognito-authenticator/hooks/useSignedIn\";\n\nconst SignedIn: React.FC = ({ children }) => {\n const { shouldRender } = useSignedIn();\n\n return shouldRender ? (children as unknown as React.ReactElement) : null;\n};\n\nexport default SignedIn;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["SignedIn","children","useSignedIn","shouldRender"],"sources":["SignedIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { useSignedIn } from \"@webiny/app-cognito-authenticator/hooks/useSignedIn\";\n\nconst SignedIn: React.FC = ({ children }) => {\n const { shouldRender } = useSignedIn();\n\n return shouldRender ? (children as unknown as React.ReactElement) : null;\n};\n\nexport default SignedIn;\n"],"mappings":";;;;;;AACA;AAEA,IAAMA,QAAkB,GAAG,SAArBA,QAAkB,OAAqB;EAAA,IAAfC,QAAQ,QAARA,QAAQ;EAClC,mBAAyB,IAAAC,yBAAW,GAAE;IAA9BC,YAAY,gBAAZA,YAAY;EAEpB,OAAOA,YAAY,GAAIF,QAAQ,GAAqC,IAAI;AAC5E,CAAC;AAAC,eAEaD,QAAQ;AAAA"}
|
package/views/StateContainer.js
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _appAdmin = require("@webiny/app-admin");
|
|
13
|
-
|
|
14
10
|
var _StyledComponents = require("./StyledComponents");
|
|
15
|
-
|
|
16
11
|
var StateContainer = function StateContainer(_ref) {
|
|
17
12
|
var children = _ref.children;
|
|
18
13
|
return /*#__PURE__*/React.createElement(_StyledComponents.Wrapper, null, /*#__PURE__*/React.createElement(_StyledComponents.LogoWrapper, null, /*#__PURE__*/React.createElement(_appAdmin.Logo, null)), /*#__PURE__*/React.createElement(_StyledComponents.LoginContent, null, children));
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
var _default = StateContainer;
|
|
22
16
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StateContainer","children"],"sources":["StateContainer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Logo } from \"@webiny/app-admin\";\nimport { LoginContent, LogoWrapper, Wrapper } from \"./StyledComponents\";\n\nconst StateContainer: React.FC = ({ children }) => (\n <Wrapper>\n <LogoWrapper>\n <Logo />\n </LogoWrapper>\n <LoginContent>{children}</LoginContent>\n </Wrapper>\n);\n\nexport default StateContainer;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["StateContainer","children"],"sources":["StateContainer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Logo } from \"@webiny/app-admin\";\nimport { LoginContent, LogoWrapper, Wrapper } from \"./StyledComponents\";\n\nconst StateContainer: React.FC = ({ children }) => (\n <Wrapper>\n <LogoWrapper>\n <Logo />\n </LogoWrapper>\n <LoginContent>{children}</LoginContent>\n </Wrapper>\n);\n\nexport default StateContainer;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEA,IAAMA,cAAwB,GAAG,SAA3BA,cAAwB;EAAA,IAAMC,QAAQ,QAARA,QAAQ;EAAA,oBACxC,oBAAC,yBAAO,qBACJ,oBAAC,6BAAW,qBACR,oBAAC,cAAI,OAAG,CACE,eACd,oBAAC,8BAAY,QAAEA,QAAQ,CAAgB,CACjC;AAAA,CACb;AAAC,eAEaD,cAAc;AAAA"}
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="web" />
|
|
3
2
|
/// <reference types="react" />
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare const
|
|
3
|
+
/// <reference types="web" />
|
|
4
|
+
export declare const Wrapper: import("@emotion/styled").StyledComponent<{
|
|
5
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
6
|
+
as?: import("react").ElementType<any> | undefined;
|
|
7
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
8
|
+
export declare const LogoWrapper: import("@emotion/styled").StyledComponent<{
|
|
9
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
10
|
+
as?: import("react").ElementType<any> | undefined;
|
|
11
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
12
|
+
export declare const LoginContent: import("@emotion/styled").StyledComponent<{
|
|
13
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
14
|
+
as?: import("react").ElementType<any> | undefined;
|
|
15
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
|
+
export declare const InnerContent: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
18
|
+
as?: import("react").ElementType<any> | undefined;
|
|
19
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
20
|
+
export declare const Footer: import("@emotion/styled").StyledComponent<{
|
|
21
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
22
|
+
as?: import("react").ElementType<any> | undefined;
|
|
23
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
24
|
+
export declare const Title: import("@emotion/styled").StyledComponent<{
|
|
25
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
26
|
+
as?: import("react").ElementType<any> | undefined;
|
|
27
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
10
28
|
export declare const alignRight: string;
|
|
11
29
|
export declare const alignCenter: string;
|
|
12
30
|
export declare const errorMessage: string;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.errorMessage = exports.alignRight = exports.alignCenter = exports.Wrapper = exports.Title = exports.LogoWrapper = exports.LoginContent = exports.InnerContent = exports.Footer = void 0;
|
|
9
|
-
|
|
10
8
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
11
|
-
|
|
12
9
|
var _emotion = require("emotion");
|
|
13
|
-
|
|
14
10
|
var Wrapper = /*#__PURE__*/(0, _styled.default)("section", {
|
|
15
11
|
target: "exiqwj40",
|
|
16
12
|
label: "Wrapper"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Wrapper","styled","display","flexDirection","justifyContent","minHeight","color","LogoWrapper","margin","marginBottom","LoginContent","width","maxWidth","borderRadius","boxShadow","a","textDecoration","fontWeight","InnerContent","position","padding","Footer","textAlign","Title","alignRight","css","alignCenter","errorMessage"],"sources":["StyledComponents.ts"],"sourcesContent":["import styled from \"@emotion/styled\";\nimport { css } from \"emotion\";\n\nexport const Wrapper = styled(\"section\")({\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n minHeight: \"100vh\",\n color: \"var(--mdc-theme-on-surface)\"\n});\n\nexport const LogoWrapper = styled(\"div\")({\n margin: \"0 auto\",\n marginBottom: 30\n});\n\nexport const LoginContent = styled(\"div\")({\n width: \"100%\",\n maxWidth: 500,\n margin: \"0 auto 25px auto\",\n \".mdc-elevation--z2\": {\n borderRadius: 4,\n boxShadow: \"0 1px 3px 0 rgba(0,0,0,0.15)\"\n },\n a: {\n textDecoration: \"none\",\n color: \"var(--mdc-theme-primary)\",\n fontWeight: 600,\n \"&:hover\": {\n textDecoration: \"underline\"\n }\n }\n});\n\nexport const InnerContent = styled(\"div\")({\n position: \"relative\",\n padding: 25\n});\n\nexport const Footer = styled(\"div\")({\n textAlign: \"center\",\n marginBottom: 75,\n a: {\n textDecoration: \"none\",\n color: \"var(--mdc-theme-primary)\"\n }\n});\n\nexport const Title = styled(\"div\")({\n textAlign: \"center\",\n margin: \"10px 25px\"\n});\n\nexport const alignRight = css({\n textAlign: \"right\"\n});\n\nexport const alignCenter = css({\n textAlign: \"center\"\n});\n\nexport const errorMessage = css({\n color: \"red\"\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Wrapper","styled","display","flexDirection","justifyContent","minHeight","color","LogoWrapper","margin","marginBottom","LoginContent","width","maxWidth","borderRadius","boxShadow","a","textDecoration","fontWeight","InnerContent","position","padding","Footer","textAlign","Title","alignRight","css","alignCenter","errorMessage"],"sources":["StyledComponents.ts"],"sourcesContent":["import styled from \"@emotion/styled\";\nimport { css } from \"emotion\";\n\nexport const Wrapper = styled(\"section\")({\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n minHeight: \"100vh\",\n color: \"var(--mdc-theme-on-surface)\"\n});\n\nexport const LogoWrapper = styled(\"div\")({\n margin: \"0 auto\",\n marginBottom: 30\n});\n\nexport const LoginContent = styled(\"div\")({\n width: \"100%\",\n maxWidth: 500,\n margin: \"0 auto 25px auto\",\n \".mdc-elevation--z2\": {\n borderRadius: 4,\n boxShadow: \"0 1px 3px 0 rgba(0,0,0,0.15)\"\n },\n a: {\n textDecoration: \"none\",\n color: \"var(--mdc-theme-primary)\",\n fontWeight: 600,\n \"&:hover\": {\n textDecoration: \"underline\"\n }\n }\n});\n\nexport const InnerContent = styled(\"div\")({\n position: \"relative\",\n padding: 25\n});\n\nexport const Footer = styled(\"div\")({\n textAlign: \"center\",\n marginBottom: 75,\n a: {\n textDecoration: \"none\",\n color: \"var(--mdc-theme-primary)\"\n }\n});\n\nexport const Title = styled(\"div\")({\n textAlign: \"center\",\n margin: \"10px 25px\"\n});\n\nexport const alignRight = css({\n textAlign: \"right\"\n});\n\nexport const alignCenter = css({\n textAlign: \"center\"\n});\n\nexport const errorMessage = css({\n color: \"red\"\n});\n"],"mappings":";;;;;;;AAAA;AACA;AAEO,IAAMA,OAAO,oBAAGC,eAAM,EAAC,SAAS;EAAA;EAAA;AAAA,GAAE;EACrCC,OAAO,EAAE,MAAM;EACfC,aAAa,EAAE,QAAQ;EACvBC,cAAc,EAAE,QAAQ;EACxBC,SAAS,EAAE,OAAO;EAClBC,KAAK,EAAE;AACX,CAAC,CAAC;AAAC;AAEI,IAAMC,WAAW,oBAAGN,eAAM,EAAC,KAAK;EAAA;EAAA;AAAA,GAAE;EACrCO,MAAM,EAAE,QAAQ;EAChBC,YAAY,EAAE;AAClB,CAAC,CAAC;AAAC;AAEI,IAAMC,YAAY,oBAAGT,eAAM,EAAC,KAAK;EAAA;EAAA;AAAA,GAAE;EACtCU,KAAK,EAAE,MAAM;EACbC,QAAQ,EAAE,GAAG;EACb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