@skroz/frontend 0.0.2 → 0.0.4
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/dist/auth/Forgot.js +5 -7
- package/dist/auth/Login.js +2 -6
- package/dist/auth/RecoverPassword.js +8 -8
- package/dist/auth/Register.js +2 -6
- package/dist/auth/ResendLinkButton.js +5 -6
- package/dist/ui/SeoHead.d.ts +2 -2
- package/dist/ui/SeoHead.js +1 -1
- package/package.json +2 -2
- package/src/auth/Forgot.tsx +92 -91
- package/src/auth/Login.tsx +3 -11
- package/src/auth/RecoverPassword.tsx +155 -150
- package/src/auth/Register.tsx +3 -11
- package/src/auth/ResendLinkButton.tsx +5 -10
- package/src/ui/SeoHead.tsx +4 -4
package/dist/auth/Forgot.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
2
|
var __assign = (this && this.__assign) || function () {
|
|
7
3
|
__assign = Object.assign || function(t) {
|
|
8
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -31,6 +27,7 @@ var limitExpiresAt_1 = require("../utils/limitExpiresAt");
|
|
|
31
27
|
var handleFormErrors_1 = __importDefault(require("../utils/handleFormErrors"));
|
|
32
28
|
var H_1 = __importDefault(require("../ui/H"));
|
|
33
29
|
var FrontendContext_1 = require("../utils/FrontendContext");
|
|
30
|
+
var ForgotPasswordMutation_graphql_1 = __importDefault(require("../graphql/ForgotPasswordMutation.graphql"));
|
|
34
31
|
var FormItem_1 = __importDefault(require("../ui/FormItem"));
|
|
35
32
|
var Forgot = function (_a) {
|
|
36
33
|
var onFinish = _a.onFinish, onLoginClick = _a.onLoginClick;
|
|
@@ -39,7 +36,7 @@ var Forgot = function (_a) {
|
|
|
39
36
|
var config = (0, FrontendContext_1.useFrontendConfig)();
|
|
40
37
|
var _b = (0, form_1.useExistingForm)(), form = _b.form, useValue = _b.useValue, Field = _b.Field;
|
|
41
38
|
var email = useValue('email');
|
|
42
|
-
var _c = (0, react_relay_1.useMutation)(
|
|
39
|
+
var _c = (0, react_relay_1.useMutation)(ForgotPasswordMutation_graphql_1.default), commit = _c[0], loading = _c[1];
|
|
43
40
|
var forgotPasswordHandler = (0, react_1.useCallback)(function () {
|
|
44
41
|
commit({
|
|
45
42
|
variables: {
|
|
@@ -61,8 +58,9 @@ var Forgot = function (_a) {
|
|
|
61
58
|
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: 'auth no-text-selection' }, { children: [(0, jsx_runtime_1.jsx)(H_1.default, __assign({ type: 'h1', textAlign: 'center' }, { children: t('common:auth.forgotTitle') })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: 'auth-subtitle' }, { children: [t('common:auth.forgotSubtitle'), ' ', onLoginClick ? (loginButton) : ((0, jsx_runtime_1.jsx)(link_1.default, __assign({ href: config.loginPath || '/login', passHref: true }, { children: loginButton })))] })), (0, jsx_runtime_1.jsx)(antd_1.Form, __assign({ size: 'large' }, { children: (0, jsx_runtime_1.jsx)(Field, { name: 'email', render: function (_a, _b) {
|
|
62
59
|
var value = _a.value, onChange = _a.onChange;
|
|
63
60
|
var error = _b.error;
|
|
64
|
-
return ((0, jsx_runtime_1.jsx)(FormItem_1.default, __assign({ error: error }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { value: value, prefix: (0, jsx_runtime_1.jsx)(icons_1.UserOutlined, {}), onChange: function (e) {
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(FormItem_1.default, __assign({ error: error }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { value: value, prefix: (0, jsx_runtime_1.jsx)(icons_1.UserOutlined, {}), onChange: function (e) {
|
|
62
|
+
return onChange(e.target.value);
|
|
63
|
+
}, placeholder: 'Email', size: 'large' }) })));
|
|
65
64
|
} }) })), (0, jsx_runtime_1.jsx)("div", __assign({ className: 'auth-button' }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, __assign({ type: 'primary', shape: 'round', size: 'large', loading: loading, onClick: forgotPasswordHandler }, { children: t('common:auth.forgotSendInstructions') })) })), (0, jsx_runtime_1.jsx)("div", __assign({ className: 'auth-footer' }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: 'auth-footer-issues' }, { children: t('common:auth.forgotIssues') })) }))] })));
|
|
66
65
|
};
|
|
67
66
|
exports.default = Forgot;
|
|
68
|
-
var templateObject_1;
|
package/dist/auth/Login.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
2
|
var __assign = (this && this.__assign) || function () {
|
|
7
3
|
__assign = Object.assign || function(t) {
|
|
8
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -26,6 +22,7 @@ var next_i18next_1 = require("next-i18next");
|
|
|
26
22
|
var link_1 = __importDefault(require("next/link"));
|
|
27
23
|
var react_relay_1 = require("react-relay");
|
|
28
24
|
var form_1 = require("@os-design/form");
|
|
25
|
+
var LoginMutation_graphql_1 = __importDefault(require("../graphql/LoginMutation.graphql"));
|
|
29
26
|
var handleFormErrors_1 = __importDefault(require("../utils/handleFormErrors"));
|
|
30
27
|
var AuthFooterLinks_1 = __importDefault(require("./AuthFooterLinks"));
|
|
31
28
|
var H_1 = __importDefault(require("../ui/H"));
|
|
@@ -37,7 +34,7 @@ var Login = function (_a) {
|
|
|
37
34
|
var router = (0, router_1.useRouter)();
|
|
38
35
|
var form = (0, form_1.useExistingForm)().form;
|
|
39
36
|
var config = (0, FrontendContext_1.useFrontendConfig)();
|
|
40
|
-
var _b = (0, react_relay_1.useMutation)(
|
|
37
|
+
var _b = (0, react_relay_1.useMutation)(LoginMutation_graphql_1.default), commit = _b[0], loading = _b[1];
|
|
41
38
|
var loginHandler = (0, react_1.useCallback)(function () {
|
|
42
39
|
commit({
|
|
43
40
|
variables: {
|
|
@@ -62,4 +59,3 @@ var Login = function (_a) {
|
|
|
62
59
|
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: 'auth no-text-selection' }, { children: [(0, jsx_runtime_1.jsx)(H_1.default, __assign({ type: 'h1', textAlign: 'center' }, { children: t('common:auth.loginTitle') })), !isModal && ((0, jsx_runtime_1.jsxs)("div", __assign({ className: 'auth-subtitle' }, { children: [t('common:auth.loginSubtitle'), ' ', (0, jsx_runtime_1.jsx)(link_1.default, __assign({ href: config.registerPath || '/register', passHref: true }, { children: registerButton }))] }))), (0, jsx_runtime_1.jsx)(LoginForm_1.default, { onPressEnter: loginHandler }), (0, jsx_runtime_1.jsx)("div", __assign({ className: 'auth-button' }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, __assign({ type: 'primary', shape: 'round', size: 'large', loading: loading, onClick: loginHandler }, { children: t('common:buttons.login') })) })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: 'auth-footer' }, { children: [(0, jsx_runtime_1.jsx)("div", { children: onForgotClick ? (forgotButton) : ((0, jsx_runtime_1.jsx)(link_1.default, __assign({ href: config.forgotPasswordPath || '/forgot', passHref: true }, { children: forgotButton }))) }), (0, jsx_runtime_1.jsx)(AuthFooterLinks_1.default, {})] }))] })));
|
|
63
60
|
};
|
|
64
61
|
exports.default = Login;
|
|
65
|
-
var templateObject_1;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
2
|
var __assign = (this && this.__assign) || function () {
|
|
7
3
|
__assign = Object.assign || function(t) {
|
|
8
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -29,6 +25,7 @@ var link_1 = __importDefault(require("next/link"));
|
|
|
29
25
|
var use_interval_1 = __importDefault(require("@os-design/use-interval"));
|
|
30
26
|
var handleFormErrors_1 = __importDefault(require("../utils/handleFormErrors"));
|
|
31
27
|
var FrontendContext_1 = require("../utils/FrontendContext");
|
|
28
|
+
var recoveryMutation_graphql_1 = __importDefault(require("../graphql/recoveryMutation.graphql"));
|
|
32
29
|
var H_1 = __importDefault(require("../ui/H"));
|
|
33
30
|
var Panel_1 = __importDefault(require("../ui/Panel"));
|
|
34
31
|
var FormItem_1 = __importDefault(require("../ui/FormItem"));
|
|
@@ -46,7 +43,7 @@ var RecoverPassword = function () {
|
|
|
46
43
|
token: '',
|
|
47
44
|
password: '',
|
|
48
45
|
}), form = _a.form, Field = _a.Field;
|
|
49
|
-
var _b = (0, react_relay_1.useMutation)(
|
|
46
|
+
var _b = (0, react_relay_1.useMutation)(recoveryMutation_graphql_1.default), commit = _b[0], loading = _b[1];
|
|
50
47
|
var recoverPasswordHandler = (0, react_1.useCallback)(function () {
|
|
51
48
|
commit({
|
|
52
49
|
variables: {
|
|
@@ -77,7 +74,9 @@ var RecoverPassword = function () {
|
|
|
77
74
|
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: 'recovery' }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: 'recovery-header' }, { children: t('common:auth.setNewPassword') })), email.length > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ style: { color: 'red', marginBottom: 15 } }, { children: t('common:auth.findCodeOnEmail') })), (0, jsx_runtime_1.jsx)(form_1.FormProvider, __assign({ form: form }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, __assign({ layout: 'vertical', size: 'large' }, { children: [(0, jsx_runtime_1.jsx)(FormError_1.default, {}), (0, jsx_runtime_1.jsx)(Field, { name: 'token', render: function (_a, _b) {
|
|
78
75
|
var value = _a.value, onChange = _a.onChange;
|
|
79
76
|
var error = _b.error;
|
|
80
|
-
return ((0, jsx_runtime_1.jsx)(FormItem_1.default, __assign({ label: '\u041A\u043E\u0434 \u0438\u0437 \u043F\u0438\u0441\u044C\u043C\u0430', error: error, style: { marginBottom: 0 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: '------', value: value, onChange: function (e) {
|
|
77
|
+
return ((0, jsx_runtime_1.jsx)(FormItem_1.default, __assign({ label: '\u041A\u043E\u0434 \u0438\u0437 \u043F\u0438\u0441\u044C\u043C\u0430', error: error, style: { marginBottom: 0 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: '------', value: value, onChange: function (e) {
|
|
78
|
+
return onChange(e.target.value);
|
|
79
|
+
} }) })));
|
|
81
80
|
} }), (0, jsx_runtime_1.jsx)("div", __assign({ style: { marginBottom: 25 } }, { children: (0, jsx_runtime_1.jsx)(ResendLinkButton_1.default, __assign({ email: email, type: 'recovery', disabled: resendIsDenied, onError: function (error) { return (0, handleFormErrors_1.default)(form, error); }, onCompleted: function (res) {
|
|
82
81
|
(0, limitExpiresAt_1.setLimitExpiresAt)(res.resendLink.limitExpiresAt);
|
|
83
82
|
setLimitExpiresIn((0, limitExpiresAt_1.getLimitExpiresIn)());
|
|
@@ -89,8 +88,9 @@ var RecoverPassword = function () {
|
|
|
89
88
|
} }, { children: getResendButtonTitle() })) })), (0, jsx_runtime_1.jsxs)(Panel_1.default, __assign({ bg: 'secondary' }, { children: [(0, jsx_runtime_1.jsx)(Field, { name: 'password', render: function (_a, _b) {
|
|
90
89
|
var value = _a.value, onChange = _a.onChange;
|
|
91
90
|
var error = _b.error;
|
|
92
|
-
return ((0, jsx_runtime_1.jsx)(FormItem_1.default, __assign({ label: t('common:auth.setNewPassword'), error: error }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input.Password, { value: value, onChange: function (e) {
|
|
91
|
+
return ((0, jsx_runtime_1.jsx)(FormItem_1.default, __assign({ label: t('common:auth.setNewPassword'), error: error }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input.Password, { value: value, onChange: function (e) {
|
|
92
|
+
return onChange(e.target.value);
|
|
93
|
+
}, placeholder: t('common:auth.newPassword') }) })));
|
|
93
94
|
} }), (0, jsx_runtime_1.jsx)(antd_1.Button, __assign({ loading: loading, onClick: recoverPasswordHandler, type: 'primary' }, { children: t('common:auth.saveNewPassword') }))] }))] })) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(H_1.default, __assign({ type: 'h2', subHeader: '\u0412\u044B \u043F\u0435\u0440\u0435\u0448\u043B\u0438 \u043D\u0430 \u044D\u0442\u0443 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u0441 \u043D\u0435\u0432\u0435\u0440\u043D\u044B\u043C\u0438 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u043C\u0438, \u0432\u0435\u0440\u043D\u0438\u0442\u0435\u0441\u044C \u043D\u0430\u0437\u0430\u0434, \u0447\u0442\u043E\u0431\u044B \u0438\u0441\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0443', textAlign: 'center' }, { children: "\u041E\u0448\u0438\u0431\u043E\u0447\u043D\u044B\u0435 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B" })), (0, jsx_runtime_1.jsx)("div", __assign({ style: { textAlign: 'center' } }, { children: (0, jsx_runtime_1.jsx)(link_1.default, __assign({ href: config.forgotPasswordPath || '/forgot' }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, __assign({ type: 'primary', shape: 'round', size: 'large' }, { children: "\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u043D\u0430\u0437\u0430\u0434" })) })) }))] }))] })));
|
|
94
95
|
};
|
|
95
96
|
exports.default = RecoverPassword;
|
|
96
|
-
var templateObject_1;
|
package/dist/auth/Register.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
2
|
var __assign = (this && this.__assign) || function () {
|
|
7
3
|
__assign = Object.assign || function(t) {
|
|
8
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -30,6 +26,7 @@ var handleFormErrors_1 = __importDefault(require("../utils/handleFormErrors"));
|
|
|
30
26
|
var AuthFooterLinks_1 = __importDefault(require("./AuthFooterLinks"));
|
|
31
27
|
var H_1 = __importDefault(require("../ui/H"));
|
|
32
28
|
var FrontendContext_1 = require("../utils/FrontendContext");
|
|
29
|
+
var RegisterMutation_graphql_1 = __importDefault(require("../graphql/RegisterMutation.graphql"));
|
|
33
30
|
var LoginForm_1 = __importDefault(require("./LoginForm"));
|
|
34
31
|
var FormItem_1 = __importDefault(require("../ui/FormItem"));
|
|
35
32
|
var Register = function (_a) {
|
|
@@ -38,7 +35,7 @@ var Register = function (_a) {
|
|
|
38
35
|
var router = (0, router_1.useRouter)();
|
|
39
36
|
var config = (0, FrontendContext_1.useFrontendConfig)();
|
|
40
37
|
var _b = (0, form_1.useExistingForm)(), form = _b.form, Field = _b.Field;
|
|
41
|
-
var _c = (0, react_relay_1.useMutation)(
|
|
38
|
+
var _c = (0, react_relay_1.useMutation)(RegisterMutation_graphql_1.default), commit = _c[0], loading = _c[1];
|
|
42
39
|
var registerHandler = (0, react_1.useCallback)(function () {
|
|
43
40
|
commit({
|
|
44
41
|
variables: {
|
|
@@ -65,4 +62,3 @@ var Register = function (_a) {
|
|
|
65
62
|
} })] }), (0, jsx_runtime_1.jsx)("div", __assign({ className: 'auth-button' }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, __assign({ type: 'primary', shape: 'round', size: 'large', loading: loading, onClick: registerHandler }, { children: t('common:buttons.register') })) })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: 'auth-footer' }, { children: [(0, jsx_runtime_1.jsx)("div", { children: onForgotClick ? (forgotButton) : ((0, jsx_runtime_1.jsx)(link_1.default, __assign({ href: config.forgotPasswordPath || '/forgot', passHref: true }, { children: forgotButton }))) }), (0, jsx_runtime_1.jsx)(AuthFooterLinks_1.default, {})] }))] })));
|
|
66
63
|
};
|
|
67
64
|
exports.default = Register;
|
|
68
|
-
var templateObject_1;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
2
|
var __assign = (this && this.__assign) || function () {
|
|
7
3
|
__assign = Object.assign || function(t) {
|
|
8
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -14,16 +10,20 @@ var __assign = (this && this.__assign) || function () {
|
|
|
14
10
|
};
|
|
15
11
|
return __assign.apply(this, arguments);
|
|
16
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
17
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
18
|
var react_1 = require("react");
|
|
20
19
|
var react_relay_1 = require("react-relay");
|
|
21
20
|
var antd_1 = require("antd");
|
|
22
21
|
var next_i18next_1 = require("next-i18next");
|
|
22
|
+
var ResendLinkButtonMutation_graphql_1 = __importDefault(require("../graphql/ResendLinkButtonMutation.graphql"));
|
|
23
23
|
var ResendLinkButton = function (_a) {
|
|
24
24
|
var type = _a.type, email = _a.email, children = _a.children, disabled = _a.disabled, onCompleted = _a.onCompleted, onError = _a.onError;
|
|
25
25
|
var t = (0, next_i18next_1.useTranslation)().t;
|
|
26
|
-
var _b = (0, react_relay_1.useMutation)(
|
|
26
|
+
var _b = (0, react_relay_1.useMutation)(ResendLinkButtonMutation_graphql_1.default), commit = _b[0], loading = _b[1];
|
|
27
27
|
var resendLinkHandler = (0, react_1.useCallback)(function () {
|
|
28
28
|
if (!email) {
|
|
29
29
|
antd_1.message.error(t('error.emailNotProvided'));
|
|
@@ -47,4 +47,3 @@ var ResendLinkButton = function (_a) {
|
|
|
47
47
|
return ((0, jsx_runtime_1.jsx)(antd_1.Button, __assign({ type: 'link', disabled: disabled, onClick: resendLinkHandler, loading: loading, size: 'large' }, { children: children })));
|
|
48
48
|
};
|
|
49
49
|
exports.default = ResendLinkButton;
|
|
50
|
-
var templateObject_1;
|
package/dist/ui/SeoHead.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ interface SeoHeadProps {
|
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
metaTitle: string;
|
|
5
5
|
metaDescription: string;
|
|
6
|
-
noindex
|
|
7
|
-
nofollow
|
|
6
|
+
noindex: boolean;
|
|
7
|
+
nofollow: boolean;
|
|
8
8
|
smmType?: 'website' | 'profile';
|
|
9
9
|
smmImageUrl?: string;
|
|
10
10
|
smmPageUrl?: string;
|
package/dist/ui/SeoHead.js
CHANGED
|
@@ -7,7 +7,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
var head_1 = __importDefault(require("next/head"));
|
|
8
8
|
var FrontendContext_1 = require("../utils/FrontendContext");
|
|
9
9
|
var SeoHead = function (_a) {
|
|
10
|
-
var metaTitle = _a.metaTitle, metaDescription = _a.metaDescription, children = _a.children,
|
|
10
|
+
var metaTitle = _a.metaTitle, metaDescription = _a.metaDescription, children = _a.children, noindex = _a.noindex, nofollow = _a.nofollow, smmImageUrl = _a.smmImageUrl, smmPageUrl = _a.smmPageUrl, _b = _a.smmType, smmType = _b === void 0 ? 'website' : _b;
|
|
11
11
|
var domain = (0, FrontendContext_1.useFrontendConfig)().domain;
|
|
12
12
|
return ((0, jsx_runtime_1.jsxs)(head_1.default, { children: [(0, jsx_runtime_1.jsx)("title", { children: metaTitle }), (0, jsx_runtime_1.jsx)("meta", { name: 'description', content: metaDescription }), (0, jsx_runtime_1.jsx)("meta", { name: 'theme-color', content: '#edf1f6' }), (0, jsx_runtime_1.jsx)("meta", { charSet: 'UTF-8' }), (0, jsx_runtime_1.jsx)("meta", { name: 'viewport', content: 'width=device-width, initial-scale=1, viewport-fit=cover' }), (0, jsx_runtime_1.jsx)("link", { rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png' }), (0, jsx_runtime_1.jsx)("link", { rel: 'icon', type: 'image/png', sizes: '32x32', href: '/favicon-32x32.png' }), (0, jsx_runtime_1.jsx)("link", { rel: 'icon', type: 'image/png', sizes: '16x16', href: '/favicon-16x16.png' }), (0, jsx_runtime_1.jsx)("link", { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }), (0, jsx_runtime_1.jsx)("link", { rel: 'manifest', href: '/manifest.json' }), (0, jsx_runtime_1.jsx)("meta", { name: 'robots', content: "".concat(noindex ? 'noindex' : 'index', ",").concat(nofollow ? 'nofollow' : 'follow') }), (0, jsx_runtime_1.jsx)("meta", { property: 'og:type', content: smmType }), smmPageUrl && (0, jsx_runtime_1.jsx)("meta", { property: 'og:url', content: smmPageUrl }), smmImageUrl && (0, jsx_runtime_1.jsx)("meta", { name: 'og:image', content: smmImageUrl }), (0, jsx_runtime_1.jsx)("meta", { property: 'og:title', content: metaTitle }), (0, jsx_runtime_1.jsx)("meta", { property: 'og:description', content: metaDescription }), (0, jsx_runtime_1.jsx)("meta", { name: 'twitter:card', content: 'summary_large_image' }), smmImageUrl && (0, jsx_runtime_1.jsx)("meta", { name: 'twitter:image', content: smmImageUrl }), domain && (0, jsx_runtime_1.jsx)("meta", { property: 'twitter:domain', content: domain }), smmPageUrl && (0, jsx_runtime_1.jsx)("meta", { property: 'twitter:url', content: smmPageUrl }), (0, jsx_runtime_1.jsx)("meta", { name: 'twitter:title', content: metaTitle }), (0, jsx_runtime_1.jsx)("meta", { name: 'twitter:description', content: metaDescription }), children] }));
|
|
13
13
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skroz/frontend",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "a15d77b45c43d03cd83679b927f193e9d8f7bf28"
|
|
48
48
|
}
|
package/src/auth/Forgot.tsx
CHANGED
|
@@ -5,118 +5,119 @@ import { UserOutlined } from '@ant-design/icons';
|
|
|
5
5
|
import { useTranslation } from 'next-i18next';
|
|
6
6
|
import Link from 'next/link';
|
|
7
7
|
import { useExistingForm } from '@os-design/form';
|
|
8
|
-
import {
|
|
8
|
+
import { useMutation } from 'react-relay';
|
|
9
9
|
import { setLimitExpiresAt } from '../utils/limitExpiresAt';
|
|
10
10
|
import handleFormErrors from '../utils/handleFormErrors';
|
|
11
11
|
import H from '../ui/H';
|
|
12
12
|
import { useFrontendConfig } from '../utils/FrontendContext';
|
|
13
13
|
import { RegisterInput } from '../graphql/RegisterMutation.graphql';
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
import ForgotPasswordMutationNode, {
|
|
15
|
+
ForgotPasswordMutation,
|
|
16
|
+
ForgotPasswordMutation$data,
|
|
17
17
|
} from '../graphql/ForgotPasswordMutation.graphql';
|
|
18
18
|
import FormItem from '../ui/FormItem';
|
|
19
19
|
|
|
20
20
|
interface ForgotProps {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
onFinish: () => void;
|
|
22
|
+
onLoginClick?: () => void;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const Forgot: React.FC<ForgotProps> = ({ onFinish, onLoginClick }) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const { t } = useTranslation();
|
|
27
|
+
const router = useRouter();
|
|
28
|
+
const config = useFrontendConfig();
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const { form, useValue, Field } = useExistingForm<RegisterInput>();
|
|
31
|
+
const email = useValue('email');
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
forgotPassword(input: $input) {
|
|
37
|
-
recoveryLinkIsSent
|
|
38
|
-
limitExpiresAt
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
`
|
|
42
|
-
);
|
|
33
|
+
const [commit, loading] = useMutation<ForgotPasswordMutation>(
|
|
34
|
+
ForgotPasswordMutationNode
|
|
35
|
+
);
|
|
43
36
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
37
|
+
const forgotPasswordHandler = useCallback(() => {
|
|
38
|
+
commit({
|
|
39
|
+
variables: {
|
|
40
|
+
input: {
|
|
41
|
+
email,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
onError: (error) => handleFormErrors(form, error),
|
|
45
|
+
onCompleted: (res: ForgotPasswordMutation$data) => {
|
|
46
|
+
setLimitExpiresAt(res.forgotPassword.limitExpiresAt);
|
|
47
|
+
if (!res.forgotPassword.recoveryLinkIsSent)
|
|
48
|
+
message.error(t('common:auth.forgotSendError'));
|
|
49
|
+
router.push(`/recovery?email=${email}`);
|
|
50
|
+
onFinish();
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}, [commit, email, form, onFinish, router, t]);
|
|
61
54
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
const loginButton = (
|
|
56
|
+
<Button type='link' onClick={onLoginClick} shape='round'>
|
|
57
|
+
{t('common:buttons.login')}
|
|
58
|
+
</Button>
|
|
59
|
+
);
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
61
|
+
return (
|
|
62
|
+
<div className='auth no-text-selection'>
|
|
63
|
+
<H type='h1' textAlign='center'>
|
|
64
|
+
{t('common:auth.forgotTitle')}
|
|
65
|
+
</H>
|
|
66
|
+
<div className='auth-subtitle'>
|
|
67
|
+
{t('common:auth.forgotSubtitle')}{' '}
|
|
68
|
+
{onLoginClick ? (
|
|
69
|
+
loginButton
|
|
70
|
+
) : (
|
|
71
|
+
<Link href={config.loginPath || '/login'} passHref>
|
|
72
|
+
{loginButton}
|
|
73
|
+
</Link>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
83
76
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
77
|
+
<Form size='large'>
|
|
78
|
+
<Field
|
|
79
|
+
name='email'
|
|
80
|
+
render={(
|
|
81
|
+
{
|
|
82
|
+
value,
|
|
83
|
+
onChange,
|
|
84
|
+
}: { value: string; onChange: (val: string) => void },
|
|
85
|
+
{ error }: { error?: string }
|
|
86
|
+
) => (
|
|
87
|
+
<FormItem error={error}>
|
|
88
|
+
<Input
|
|
89
|
+
value={value}
|
|
90
|
+
prefix={<UserOutlined />}
|
|
91
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
92
|
+
onChange(e.target.value)
|
|
93
|
+
}
|
|
94
|
+
placeholder='Email'
|
|
95
|
+
size='large'
|
|
96
|
+
/>
|
|
97
|
+
</FormItem>
|
|
98
|
+
)}
|
|
99
|
+
/>
|
|
100
|
+
</Form>
|
|
100
101
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
<div className='auth-button'>
|
|
103
|
+
<Button
|
|
104
|
+
type='primary'
|
|
105
|
+
shape='round'
|
|
106
|
+
size='large'
|
|
107
|
+
loading={loading}
|
|
108
|
+
onClick={forgotPasswordHandler}
|
|
109
|
+
>
|
|
110
|
+
{t('common:auth.forgotSendInstructions')}
|
|
111
|
+
</Button>
|
|
112
|
+
</div>
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
114
|
+
<div className='auth-footer'>
|
|
115
|
+
<div className='auth-footer-issues'>
|
|
116
|
+
{t('common:auth.forgotIssues')}
|
|
118
117
|
</div>
|
|
119
|
-
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
120
121
|
};
|
|
121
122
|
|
|
122
123
|
export default Forgot;
|
package/src/auth/Login.tsx
CHANGED
|
@@ -3,9 +3,9 @@ import { Button, message } from 'antd';
|
|
|
3
3
|
import { useRouter } from 'next/router';
|
|
4
4
|
import { useTranslation } from 'next-i18next';
|
|
5
5
|
import Link from 'next/link';
|
|
6
|
-
import {
|
|
6
|
+
import { useMutation } from 'react-relay';
|
|
7
7
|
import { useExistingForm } from '@os-design/form';
|
|
8
|
-
import {
|
|
8
|
+
import LoginMutationNode, {
|
|
9
9
|
RegisterInput,
|
|
10
10
|
LoginMutation,
|
|
11
11
|
LoginMutation$data,
|
|
@@ -28,15 +28,7 @@ const Login: React.FC<LoginProps> = ({ onFinish, onForgotClick, isModal }) => {
|
|
|
28
28
|
const { form } = useExistingForm<RegisterInput>();
|
|
29
29
|
const config = useFrontendConfig();
|
|
30
30
|
|
|
31
|
-
const [commit, loading] = useMutation<LoginMutation>(
|
|
32
|
-
graphql`
|
|
33
|
-
mutation LoginMutation($input: RegisterInput!) {
|
|
34
|
-
login(input: $input) {
|
|
35
|
-
ok
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
`
|
|
39
|
-
);
|
|
31
|
+
const [commit, loading] = useMutation<LoginMutation>(LoginMutationNode);
|
|
40
32
|
|
|
41
33
|
const loginHandler = useCallback(() => {
|
|
42
34
|
commit({
|
|
@@ -3,14 +3,14 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
3
3
|
import { useRouter } from 'next/router';
|
|
4
4
|
import { useTranslation } from 'next-i18next';
|
|
5
5
|
import { FormProvider, useForm } from '@os-design/form';
|
|
6
|
-
import {
|
|
6
|
+
import { useMutation } from 'react-relay';
|
|
7
7
|
import Link from 'next/link';
|
|
8
8
|
import useInterval from '@os-design/use-interval';
|
|
9
9
|
import handleFormErrors from '../utils/handleFormErrors';
|
|
10
10
|
import { useFrontendConfig } from '../utils/FrontendContext';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
import recoveryMutationNode, {
|
|
12
|
+
RecoverPasswordInput,
|
|
13
|
+
recoveryMutation,
|
|
14
14
|
} from '../graphql/recoveryMutation.graphql';
|
|
15
15
|
import H from '../ui/H';
|
|
16
16
|
import Panel from '../ui/Panel';
|
|
@@ -21,165 +21,170 @@ import { ResendLinkButtonMutation$data } from '../graphql/ResendLinkButtonMutati
|
|
|
21
21
|
import { getLimitExpiresIn, setLimitExpiresAt } from '../utils/limitExpiresAt';
|
|
22
22
|
|
|
23
23
|
const RecoverPassword = () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const router = useRouter();
|
|
25
|
+
const { t } = useTranslation(['common']);
|
|
26
|
+
const config = useFrontendConfig();
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
let { email } = router.query;
|
|
29
|
+
if (typeof email !== 'string' || !email) email = '';
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const { form, Field } = useForm<RecoverPasswordInput>({
|
|
32
|
+
token: '',
|
|
33
|
+
password: '',
|
|
34
|
+
});
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
graphql`
|
|
38
|
-
mutation recoveryMutation($input: RecoverPasswordInput!) {
|
|
39
|
-
recoverPassword(input: $input) {
|
|
40
|
-
ok
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
`
|
|
44
|
-
);
|
|
36
|
+
const [commit, loading] = useMutation<recoveryMutation>(recoveryMutationNode);
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
38
|
+
const recoverPasswordHandler = useCallback(() => {
|
|
39
|
+
commit({
|
|
40
|
+
variables: {
|
|
41
|
+
input: {
|
|
42
|
+
...form.values.getAll(),
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
onError: (error) => handleFormErrors(form, error),
|
|
46
|
+
onCompleted: () => {
|
|
47
|
+
message.success(t('common:auth.recoverySuccess'));
|
|
48
|
+
const profilePath = config.defaultPath
|
|
49
|
+
? `${config.defaultPath === '/' ? '' : config.defaultPath}/profile`
|
|
50
|
+
: '/profile';
|
|
51
|
+
router.push(profilePath);
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}, [commit, form, router, t, config.defaultPath]);
|
|
63
55
|
|
|
64
|
-
|
|
56
|
+
const [limitExpiresIn, setLimitExpiresIn] = useState(0);
|
|
65
57
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
// Update limitExpiresIn
|
|
59
|
+
const updateLimitExpiresIn = useCallback(
|
|
60
|
+
() => setLimitExpiresIn(getLimitExpiresIn()),
|
|
61
|
+
[]
|
|
62
|
+
);
|
|
63
|
+
useEffect(updateLimitExpiresIn, [updateLimitExpiresIn]); // Initial update
|
|
64
|
+
useInterval(updateLimitExpiresIn, limitExpiresIn > 0 ? 1000 : null); // Update every second
|
|
73
65
|
|
|
74
|
-
|
|
66
|
+
const resendIsDenied = limitExpiresIn > 0;
|
|
75
67
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
const getResendButtonTitle = () => {
|
|
69
|
+
if (resendIsDenied) {
|
|
70
|
+
return `${t('common:auth.openEmailResendDenied')} ${Math.ceil(
|
|
71
|
+
limitExpiresIn / 1000
|
|
72
|
+
)} ${t('common:sec')}`;
|
|
73
|
+
}
|
|
74
|
+
return t('common:auth.openEmailResend');
|
|
75
|
+
};
|
|
84
76
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
{t('common:auth.setNewPassword')}
|
|
89
|
-
</div>
|
|
77
|
+
return (
|
|
78
|
+
<div className='recovery'>
|
|
79
|
+
<div className='recovery-header'>{t('common:auth.setNewPassword')}</div>
|
|
90
80
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
81
|
+
{email.length > 0 ? (
|
|
82
|
+
<>
|
|
83
|
+
<div style={{ color: 'red', marginBottom: 15 }}>
|
|
84
|
+
{t('common:auth.findCodeOnEmail')}
|
|
85
|
+
</div>
|
|
86
|
+
<FormProvider form={form}>
|
|
87
|
+
<Form layout='vertical' size='large'>
|
|
88
|
+
<FormError />
|
|
89
|
+
<Field
|
|
90
|
+
name='token'
|
|
91
|
+
render={(
|
|
92
|
+
{
|
|
93
|
+
value,
|
|
94
|
+
onChange,
|
|
95
|
+
}: { value: string; onChange: (val: string) => void },
|
|
96
|
+
{ error }: { error?: string }
|
|
97
|
+
) => (
|
|
98
|
+
<FormItem
|
|
99
|
+
label='Код из письма'
|
|
100
|
+
error={error}
|
|
101
|
+
style={{ marginBottom: 0 }}
|
|
102
|
+
>
|
|
103
|
+
<Input
|
|
104
|
+
placeholder='------'
|
|
105
|
+
value={value}
|
|
106
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
107
|
+
onChange(e.target.value)
|
|
108
|
+
}
|
|
109
|
+
/>
|
|
110
|
+
</FormItem>
|
|
111
|
+
)}
|
|
112
|
+
/>
|
|
113
|
+
<div style={{ marginBottom: 25 }}>
|
|
114
|
+
<ResendLinkButton
|
|
115
|
+
email={email}
|
|
116
|
+
type='recovery'
|
|
117
|
+
disabled={resendIsDenied}
|
|
118
|
+
onError={(error: any) => handleFormErrors(form, error)}
|
|
119
|
+
onCompleted={(res: ResendLinkButtonMutation$data) => {
|
|
120
|
+
setLimitExpiresAt(res.resendLink.limitExpiresAt);
|
|
121
|
+
setLimitExpiresIn(getLimitExpiresIn());
|
|
124
122
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
</div>
|
|
123
|
+
// Отображаем сообщение
|
|
124
|
+
if (res.resendLink.ok)
|
|
125
|
+
message.success(t('common:auth.openEmailResendOk'));
|
|
126
|
+
else message.error(t('common:auth.openEmailResendError'));
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
{getResendButtonTitle()}
|
|
130
|
+
</ResendLinkButton>
|
|
131
|
+
</div>
|
|
135
132
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
</FormItem>
|
|
150
|
-
)}
|
|
151
|
-
/>
|
|
152
|
-
<Button
|
|
153
|
-
loading={loading}
|
|
154
|
-
onClick={recoverPasswordHandler}
|
|
155
|
-
type='primary'
|
|
156
|
-
>
|
|
157
|
-
{t('common:auth.saveNewPassword')}
|
|
158
|
-
</Button>
|
|
159
|
-
</Panel>
|
|
160
|
-
</Form>
|
|
161
|
-
</FormProvider>
|
|
162
|
-
</>
|
|
163
|
-
) : (
|
|
164
|
-
<>
|
|
165
|
-
<H
|
|
166
|
-
type='h2'
|
|
167
|
-
subHeader='Вы перешли на эту страницу с неверными параметрами, вернитесь назад, чтобы исправить ошибку'
|
|
168
|
-
textAlign='center'
|
|
133
|
+
<Panel bg='secondary'>
|
|
134
|
+
<Field
|
|
135
|
+
name='password'
|
|
136
|
+
render={(
|
|
137
|
+
{
|
|
138
|
+
value,
|
|
139
|
+
onChange,
|
|
140
|
+
}: { value: string; onChange: (val: string) => void },
|
|
141
|
+
{ error }: { error?: string }
|
|
142
|
+
) => (
|
|
143
|
+
<FormItem
|
|
144
|
+
label={t('common:auth.setNewPassword')}
|
|
145
|
+
error={error}
|
|
169
146
|
>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
147
|
+
<Input.Password
|
|
148
|
+
value={value}
|
|
149
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
150
|
+
onChange(e.target.value)
|
|
151
|
+
}
|
|
152
|
+
placeholder={t('common:auth.newPassword')}
|
|
153
|
+
/>
|
|
154
|
+
</FormItem>
|
|
155
|
+
)}
|
|
156
|
+
/>
|
|
157
|
+
<Button
|
|
158
|
+
loading={loading}
|
|
159
|
+
onClick={recoverPasswordHandler}
|
|
160
|
+
type='primary'
|
|
161
|
+
>
|
|
162
|
+
{t('common:auth.saveNewPassword')}
|
|
163
|
+
</Button>
|
|
164
|
+
</Panel>
|
|
165
|
+
</Form>
|
|
166
|
+
</FormProvider>
|
|
167
|
+
</>
|
|
168
|
+
) : (
|
|
169
|
+
<>
|
|
170
|
+
<H
|
|
171
|
+
type='h2'
|
|
172
|
+
subHeader='Вы перешли на эту страницу с неверными параметрами, вернитесь назад, чтобы исправить ошибку'
|
|
173
|
+
textAlign='center'
|
|
174
|
+
>
|
|
175
|
+
Ошибочные параметры
|
|
176
|
+
</H>
|
|
177
|
+
<div style={{ textAlign: 'center' }}>
|
|
178
|
+
<Link href={config.forgotPasswordPath || '/forgot'}>
|
|
179
|
+
<Button type='primary' shape='round' size='large'>
|
|
180
|
+
Вернуться назад
|
|
181
|
+
</Button>
|
|
182
|
+
</Link>
|
|
183
|
+
</div>
|
|
184
|
+
</>
|
|
185
|
+
)}
|
|
186
|
+
</div>
|
|
187
|
+
);
|
|
183
188
|
};
|
|
184
189
|
|
|
185
190
|
export default RecoverPassword;
|
package/src/auth/Register.tsx
CHANGED
|
@@ -4,12 +4,12 @@ import { useRouter } from 'next/router';
|
|
|
4
4
|
import { useTranslation } from 'next-i18next';
|
|
5
5
|
import Link from 'next/link';
|
|
6
6
|
import { useExistingForm } from '@os-design/form';
|
|
7
|
-
import {
|
|
7
|
+
import { useMutation } from 'react-relay';
|
|
8
8
|
import handleFormErrors from '../utils/handleFormErrors';
|
|
9
9
|
import AuthFooterLinks from './AuthFooterLinks';
|
|
10
10
|
import H from '../ui/H';
|
|
11
11
|
import { useFrontendConfig } from '../utils/FrontendContext';
|
|
12
|
-
import {
|
|
12
|
+
import RegisterMutationNode, {
|
|
13
13
|
RegisterInput,
|
|
14
14
|
RegisterMutation,
|
|
15
15
|
} from '../graphql/RegisterMutation.graphql';
|
|
@@ -33,15 +33,7 @@ const Register: React.FC<RegisterProps> = ({
|
|
|
33
33
|
|
|
34
34
|
const { form, Field } = useExistingForm<RegisterInput>();
|
|
35
35
|
|
|
36
|
-
const [commit, loading] = useMutation<RegisterMutation>(
|
|
37
|
-
graphql`
|
|
38
|
-
mutation RegisterMutation($input: RegisterInput!) {
|
|
39
|
-
register(input: $input) {
|
|
40
|
-
ok
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
`
|
|
44
|
-
);
|
|
36
|
+
const [commit, loading] = useMutation<RegisterMutation>(RegisterMutationNode);
|
|
45
37
|
|
|
46
38
|
const registerHandler = useCallback(() => {
|
|
47
39
|
commit({
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useMutation } from 'react-relay';
|
|
3
3
|
import { Button, message } from 'antd';
|
|
4
4
|
import { useTranslation } from 'next-i18next';
|
|
5
|
-
import {
|
|
5
|
+
import ResendLinkButtonMutationNode, {
|
|
6
|
+
ResendLinkButtonMutation,
|
|
7
|
+
} from '../graphql/ResendLinkButtonMutation.graphql';
|
|
6
8
|
|
|
7
9
|
interface ResendLinkButtonProps {
|
|
8
10
|
type: string;
|
|
@@ -24,14 +26,7 @@ const ResendLinkButton: React.FC<ResendLinkButtonProps> = ({
|
|
|
24
26
|
const { t } = useTranslation();
|
|
25
27
|
|
|
26
28
|
const [commit, loading] = useMutation<ResendLinkButtonMutation>(
|
|
27
|
-
|
|
28
|
-
mutation ResendLinkButtonMutation($input: ResendLinkInput!) {
|
|
29
|
-
resendLink(input: $input) {
|
|
30
|
-
ok
|
|
31
|
-
limitExpiresAt
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`
|
|
29
|
+
ResendLinkButtonMutationNode
|
|
35
30
|
);
|
|
36
31
|
|
|
37
32
|
const resendLinkHandler = useCallback(() => {
|
package/src/ui/SeoHead.tsx
CHANGED
|
@@ -6,8 +6,8 @@ interface SeoHeadProps {
|
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
metaTitle: string;
|
|
8
8
|
metaDescription: string;
|
|
9
|
-
noindex
|
|
10
|
-
nofollow
|
|
9
|
+
noindex: boolean;
|
|
10
|
+
nofollow: boolean;
|
|
11
11
|
smmType?: 'website' | 'profile';
|
|
12
12
|
smmImageUrl?: string;
|
|
13
13
|
smmPageUrl?: string;
|
|
@@ -17,8 +17,8 @@ const SeoHead: React.FC<SeoHeadProps> = ({
|
|
|
17
17
|
metaTitle,
|
|
18
18
|
metaDescription,
|
|
19
19
|
children,
|
|
20
|
-
noindex
|
|
21
|
-
nofollow
|
|
20
|
+
noindex,
|
|
21
|
+
nofollow,
|
|
22
22
|
smmImageUrl,
|
|
23
23
|
smmPageUrl,
|
|
24
24
|
smmType = 'website',
|