@strapi/admin 4.1.1 → 4.2.0-alpha.O
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/admin/src/StrapiApp.js +40 -42
- package/admin/src/components/AutoReloadOverlayBlockerProvider/Blocker.js +2 -2
- package/admin/src/components/GuidedTour/Homepage/index.js +1 -1
- package/admin/src/components/GuidedTour/Modal/components/Content.js +1 -1
- package/admin/src/components/GuidedTour/Modal/components/Modal.js +2 -2
- package/admin/src/components/LeftMenu/index.js +1 -1
- package/admin/src/components/Notifications/index.js +1 -1
- package/admin/src/components/Providers/index.js +65 -32
- package/admin/src/components/Theme/index.js +11 -12
- package/admin/src/components/ThemeToggleProvider/index.js +66 -0
- package/admin/src/{pages/AuthPage/components/Logo → components/UnauthenticatedLogo}/index.js +1 -1
- package/admin/src/components/UpgradePlanModal/index.js +2 -2
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +4 -4
- package/admin/src/content-manager/components/ComponentInitializer/index.js +1 -1
- package/admin/src/content-manager/components/DynamicTable/ConfirmDialogDelete/index.js +1 -1
- package/admin/src/content-manager/components/DynamicTable/ConfirmDialogDeleteAll/index.js +1 -1
- package/admin/src/content-manager/components/DynamicZone/components/Component/index.js +2 -2
- package/admin/src/content-manager/components/DynamicZone/components/ComponentPicker/Category/ComponentCard/index.js +1 -1
- package/admin/src/content-manager/components/DynamicZone/components/ComponentPicker/Category/index.js +1 -1
- package/admin/src/content-manager/components/DynamicZone/index.js +2 -5
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +1 -6
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +0 -9
- package/admin/src/content-manager/components/FieldComponent/index.js +2 -5
- package/admin/src/content-manager/components/InputJSON/index.js +2 -5
- package/admin/src/content-manager/components/InputUID/index.js +1 -2
- package/admin/src/content-manager/components/NonRepeatableComponent/index.js +1 -1
- package/admin/src/content-manager/components/RepeatableComponent/DraggedItem/DraggingSibling.js +2 -2
- package/admin/src/content-manager/components/RepeatableComponent/DraggedItem/index.js +4 -7
- package/admin/src/content-manager/components/SelectMany/index.js +2 -2
- package/admin/src/content-manager/components/SelectOne/index.js +1 -1
- package/admin/src/content-manager/components/SelectWrapper/index.js +2 -5
- package/admin/src/content-manager/components/SelectWrapper/utils/getSelectStyles.js +1 -0
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +4 -4
- package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +5 -3
- package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +2 -2
- package/admin/src/content-manager/components/Wysiwyg/index.js +2 -2
- package/admin/src/content-manager/pages/EditSettingsView/components/DisplayedFields.js +2 -2
- package/admin/src/content-manager/pages/EditSettingsView/components/DynamicZoneList.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/RelationalFields.js +2 -2
- package/admin/src/content-manager/pages/EditSettingsView/index.js +1 -1
- package/admin/src/content-manager/pages/EditView/Header/index.js +4 -7
- package/admin/src/content-manager/pages/EditView/Informations/index.js +1 -1
- package/admin/src/content-manager/pages/EditView/index.js +5 -5
- package/admin/src/content-manager/pages/ListSettingsView/components/CardPreview.js +1 -1
- package/admin/src/content-manager/pages/ListSettingsView/components/DraggableCard.js +1 -1
- package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +1 -1
- package/admin/src/contexts/ThemeToggle/index.js +5 -0
- package/admin/src/contexts/index.js +1 -0
- package/admin/src/hooks/index.js +1 -0
- package/admin/src/hooks/useSettingsMenu/init.js +2 -2
- package/admin/src/hooks/useThemeToggle/index.js +10 -0
- package/admin/src/pages/Admin/Onboarding/index.js +1 -1
- package/admin/src/pages/App/index.js +2 -0
- package/admin/src/pages/AuthPage/components/ForgotPassword/index.js +2 -2
- package/admin/src/pages/AuthPage/components/ForgotPasswordSuccess/index.js +1 -1
- package/admin/src/pages/AuthPage/components/Login/BaseLogin.js +2 -2
- package/admin/src/pages/AuthPage/components/Oops/index.js +1 -1
- package/admin/src/pages/AuthPage/components/Register/index.js +224 -223
- package/admin/src/pages/AuthPage/components/ResetPassword/index.js +2 -2
- package/admin/src/pages/AuthPage/index.js +20 -17
- package/admin/src/pages/HomePage/ContentBlocks.js +1 -1
- package/admin/src/pages/HomePage/HomeHeader.js +1 -1
- package/admin/src/pages/HomePage/SocialLinks.js +2 -5
- package/admin/src/pages/MarketplacePage/index.js +13 -4
- package/admin/src/pages/ProfilePage/index.js +79 -15
- package/admin/src/pages/ProfilePage/utils/api.js +4 -2
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +4 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/GlobalActions/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/PluginsAndSettings/Row/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/RoleForm/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +3 -3
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/TriggerContainer/index.js +4 -4
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +3 -3
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +1 -1
- package/admin/src/pages/UseCasePage/index.js +173 -0
- package/admin/src/translations/en.json +15 -2
- package/build/1094.e1db3a1a.chunk.js +1 -0
- package/build/1454.f065d92a.chunk.js +2 -0
- package/build/{5032.ed02a466.chunk.js.LICENSE.txt → 1454.f065d92a.chunk.js.LICENSE.txt} +0 -0
- package/build/1856.a30bd09b.chunk.js +1 -0
- package/build/2481.4eae9408.chunk.js +1 -0
- package/build/{2912.38fb9bd1.chunk.js → 2912.c5f76e65.chunk.js} +1 -1
- package/build/4362.86a4e939.chunk.js +1 -0
- package/build/4715.8a2db02a.chunk.js +1 -0
- package/build/{4800.18e59c83.chunk.js → 4800.f4a1384a.chunk.js} +1 -1
- package/build/497.3fcf6196.chunk.js +1 -0
- package/build/4982.601f6196.chunk.js +1 -0
- package/build/6404.3c2d0a81.chunk.js +1 -0
- package/build/{7841.ef9bcee9.chunk.js → 7841.490dbbf1.chunk.js} +1 -1
- package/build/{8042.9b85175a.chunk.js → 8042.1d66811a.chunk.js} +2 -2
- package/build/{8042.9b85175a.chunk.js.LICENSE.txt → 8042.1d66811a.chunk.js.LICENSE.txt} +0 -0
- package/build/849.17f011e8.chunk.js +1 -0
- package/build/{2736.ee6e45c9.chunk.js → 9260.fa40c7bd.chunk.js} +2 -2
- package/build/{2736.ee6e45c9.chunk.js.LICENSE.txt → 9260.fa40c7bd.chunk.js.LICENSE.txt} +0 -0
- package/build/9853.6ff595fa.chunk.js +1 -0
- package/build/{9988.b4229043.chunk.js → 9988.fe838ba6.chunk.js} +2 -2
- package/build/{9988.b4229043.chunk.js.LICENSE.txt → 9988.fe838ba6.chunk.js.LICENSE.txt} +0 -0
- package/build/Admin-authenticatedApp.a5d2c5fa.chunk.js +1 -0
- package/build/Admin_homePage.d6754c66.chunk.js +1 -0
- package/build/Admin_marketplace.419010d8.chunk.js +1 -0
- package/build/Admin_profilePage.d7192d06.chunk.js +1 -0
- package/build/Admin_settingsPage.a8c7ded5.chunk.js +1 -0
- package/build/admin-edit-roles-page.49b6f01d.chunk.js +1 -0
- package/build/admin-edit-users.381e4a0d.chunk.js +1 -0
- package/build/admin-users.1fda1f27.chunk.js +1 -0
- package/build/{api-tokens-create-page.0981141a.chunk.js → api-tokens-create-page.db17bb39.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.3faf1af1.chunk.js → api-tokens-edit-page.c7299a77.chunk.js} +1 -1
- package/build/content-manager.8412e024.chunk.js +1 -0
- package/build/content-type-builder-translation-en-json.8034dab6.chunk.js +1 -0
- package/build/content-type-builder.cda4ba3c.chunk.js +1 -0
- package/build/{email-settings-page.4338588d.chunk.js → email-settings-page.40ee2bda.chunk.js} +1 -1
- package/build/{en-json.bb614bb0.chunk.js → en-json.b35c285f.chunk.js} +1 -1
- package/build/i18n-settings-page.c4018651.chunk.js +1 -0
- package/build/i18n-translation-de-json.c5c9054f.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.3e719c82.js +2 -0
- package/build/{main.fc123ed7.js.LICENSE.txt → main.3e719c82.js.LICENSE.txt} +0 -0
- package/build/runtime~main.66becdbd.js +1 -0
- package/build/{sso-settings-page.c073b6d7.chunk.js → sso-settings-page.121dd0a6.chunk.js} +1 -1
- package/build/{upload-settings.8e7cbc3b.chunk.js → upload-settings.4401f36d.chunk.js} +1 -1
- package/build/{upload.803ab265.chunk.js → upload.5a2dded7.chunk.js} +1 -1
- package/build/{users-advanced-settings-page.7694d3c9.chunk.js → users-advanced-settings-page.8905d8d8.chunk.js} +1 -1
- package/build/users-email-settings-page.5abb9575.chunk.js +1 -0
- package/build/users-permissions-translation-en-json.21b0fd2f.chunk.js +1 -0
- package/build/users-providers-settings-page.368893ed.chunk.js +1 -0
- package/build/users-roles-settings-page.a2f6277a.chunk.js +1 -0
- package/build/webhook-edit-page.d170eda1.chunk.js +1 -0
- package/build/{webhook-list-page.5c8f2a91.chunk.js → webhook-list-page.c21b5a9a.chunk.js} +1 -1
- package/ee/admin/pages/AuthPage/components/Login/index.js +1 -1
- package/ee/admin/pages/AuthPage/components/Providers/index.js +2 -2
- package/ee/admin/pages/SettingsPage/SingleSignOn/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Roles/CreatePage/index.js +3 -3
- package/index.js +6 -1
- package/package.json +7 -7
- package/server/routes/serve-admin-panel.js +18 -6
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/isValidJSONString.js +0 -15
- package/admin/src/themes/colors.js +0 -51
- package/admin/src/themes/fontWeights.js +0 -8
- package/admin/src/themes/index.js +0 -13
- package/admin/src/themes/sizes.js +0 -31
- package/build/1856.a06395b4.chunk.js +0 -1
- package/build/2481.7d15bd79.chunk.js +0 -1
- package/build/4261.a4e1e93c.chunk.js +0 -1
- package/build/4362.d0c1a04a.chunk.js +0 -1
- package/build/4715.31ca1967.chunk.js +0 -1
- package/build/497.8f30da61.chunk.js +0 -1
- package/build/4982.da4adb38.chunk.js +0 -1
- package/build/5032.ed02a466.chunk.js +0 -2
- package/build/6250.dc6d7a58.chunk.js +0 -1
- package/build/849.9075d399.chunk.js +0 -1
- package/build/9238.bdd93dae.chunk.js +0 -1
- package/build/Admin-authenticatedApp.013e2774.chunk.js +0 -1
- package/build/Admin_homePage.e4779166.chunk.js +0 -1
- package/build/Admin_marketplace.e8654056.chunk.js +0 -1
- package/build/Admin_profilePage.67dd744c.chunk.js +0 -1
- package/build/Admin_settingsPage.2d0d2cca.chunk.js +0 -1
- package/build/admin-edit-roles-page.2d1b6461.chunk.js +0 -1
- package/build/admin-edit-users.e736db15.chunk.js +0 -1
- package/build/admin-users.5f79c031.chunk.js +0 -1
- package/build/content-manager.141d110d.chunk.js +0 -1
- package/build/content-type-builder-translation-en-json.b3d8e9d4.chunk.js +0 -1
- package/build/content-type-builder.f1cef05c.chunk.js +0 -1
- package/build/i18n-settings-page.51e37957.chunk.js +0 -1
- package/build/main.fc123ed7.js +0 -2
- package/build/runtime~main.0866074a.js +0 -1
- package/build/users-email-settings-page.862eb51e.chunk.js +0 -1
- package/build/users-permissions-translation-en-json.1993655e.chunk.js +0 -1
- package/build/users-providers-settings-page.47f97b06.chunk.js +0 -1
- package/build/users-roles-settings-page.b67e2b4d.chunk.js +0 -1
- package/build/webhook-edit-page.adad0a42.chunk.js +0 -1
|
@@ -10,12 +10,18 @@ import { Flex } from '@strapi/design-system/Flex';
|
|
|
10
10
|
import { Link } from '@strapi/design-system/Link';
|
|
11
11
|
import { Button } from '@strapi/design-system/Button';
|
|
12
12
|
import { TextInput } from '@strapi/design-system/TextInput';
|
|
13
|
-
|
|
13
|
+
import { Checkbox } from '@strapi/design-system/Checkbox';
|
|
14
14
|
import { Grid, GridItem } from '@strapi/design-system/Grid';
|
|
15
15
|
import { Typography } from '@strapi/design-system/Typography';
|
|
16
16
|
import EyeStriked from '@strapi/icons/EyeStriked';
|
|
17
17
|
import Eye from '@strapi/icons/Eye';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
Form,
|
|
20
|
+
useQuery,
|
|
21
|
+
useNotification,
|
|
22
|
+
useTracking,
|
|
23
|
+
getYupInnerErrors,
|
|
24
|
+
} from '@strapi/helper-plugin';
|
|
19
25
|
import { useHistory } from 'react-router-dom';
|
|
20
26
|
import PropTypes from 'prop-types';
|
|
21
27
|
import { Formik } from 'formik';
|
|
@@ -24,18 +30,16 @@ import UnauthenticatedLayout, {
|
|
|
24
30
|
Column,
|
|
25
31
|
LayoutContent,
|
|
26
32
|
} from '../../../../layouts/UnauthenticatedLayout';
|
|
27
|
-
import Logo from '
|
|
33
|
+
import Logo from '../../../../components/UnauthenticatedLogo';
|
|
28
34
|
import FieldActionWrapper from '../FieldActionWrapper';
|
|
29
35
|
|
|
30
36
|
const CenteredBox = styled(Box)`
|
|
31
37
|
text-align: center;
|
|
32
38
|
`;
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// color: ${({ theme }) => theme.colors.primary600};
|
|
38
|
-
// `;
|
|
40
|
+
const A = styled.a`
|
|
41
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
42
|
+
`;
|
|
39
43
|
|
|
40
44
|
const PasswordInput = styled(TextInput)`
|
|
41
45
|
::-ms-reveal {
|
|
@@ -43,12 +47,14 @@ const PasswordInput = styled(TextInput)`
|
|
|
43
47
|
}
|
|
44
48
|
`;
|
|
45
49
|
|
|
46
|
-
const Register = ({ fieldsToDisable, noSignin, onSubmit, schema }) => {
|
|
50
|
+
const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) => {
|
|
47
51
|
const toggleNotification = useNotification();
|
|
48
52
|
const { push } = useHistory();
|
|
49
53
|
const [passwordShown, setPasswordShown] = useState(false);
|
|
50
54
|
const [confirmPasswordShown, setConfirmPasswordShown] = useState(false);
|
|
55
|
+
const [submitCount, setSubmitCount] = useState(0);
|
|
51
56
|
const [userInfo, setUserInfo] = useState({});
|
|
57
|
+
const { trackUsage } = useTracking();
|
|
52
58
|
const { formatMessage } = useIntl();
|
|
53
59
|
const query = useQuery();
|
|
54
60
|
const registrationToken = query.get('registrationToken');
|
|
@@ -99,227 +105,218 @@ const Register = ({ fieldsToDisable, noSignin, onSubmit, schema }) => {
|
|
|
99
105
|
registrationToken: registrationToken || undefined,
|
|
100
106
|
news: false,
|
|
101
107
|
}}
|
|
102
|
-
onSubmit={(data, formik) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
onSubmit={async (data, formik) => {
|
|
109
|
+
try {
|
|
110
|
+
await schema.validate(data, { abortEarly: false });
|
|
111
|
+
|
|
112
|
+
if (submitCount > 0 && authType === 'register-admin') {
|
|
113
|
+
trackUsage('didSubmitWithErrorsFirstAdmin', { count: submitCount.toString() });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (registrationToken) {
|
|
117
|
+
// We need to pass the registration token in the url param to the api in order to submit another admin user
|
|
118
|
+
onSubmit(
|
|
119
|
+
{ userInfo: omit(data, ['registrationToken']), registrationToken },
|
|
120
|
+
formik
|
|
121
|
+
);
|
|
122
|
+
} else {
|
|
123
|
+
onSubmit(data, formik);
|
|
124
|
+
}
|
|
125
|
+
} catch (err) {
|
|
126
|
+
const errors = getYupInnerErrors(err);
|
|
127
|
+
setSubmitCount(submitCount + 1);
|
|
128
|
+
|
|
129
|
+
formik.setErrors(errors);
|
|
108
130
|
}
|
|
109
131
|
}}
|
|
110
|
-
|
|
132
|
+
// Leaving this part commented when we remove the tracking for the submitCount
|
|
133
|
+
// validationSchema={schema}
|
|
111
134
|
validateOnChange={false}
|
|
112
135
|
>
|
|
113
|
-
{({ values, errors, handleChange }) =>
|
|
114
|
-
|
|
115
|
-
<
|
|
116
|
-
<
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
</Typography>
|
|
125
|
-
</Box>
|
|
126
|
-
<CenteredBox paddingBottom={7}>
|
|
127
|
-
<Typography variant="epsilon" textColor="neutral600">
|
|
128
|
-
{formatMessage({
|
|
129
|
-
id: 'Auth.form.register.subtitle',
|
|
130
|
-
defaultMessage:
|
|
131
|
-
'Your credentials are only used to authenticate yourself on the admin panel. All saved data will be stored in your own database.',
|
|
132
|
-
})}
|
|
133
|
-
</Typography>
|
|
134
|
-
</CenteredBox>
|
|
135
|
-
</Column>
|
|
136
|
-
<Stack size={7}>
|
|
137
|
-
<Grid gap={4}>
|
|
138
|
-
<GridItem col={6}>
|
|
139
|
-
<TextInput
|
|
140
|
-
name="firstname"
|
|
141
|
-
required
|
|
142
|
-
value={values.firstname}
|
|
143
|
-
error={
|
|
144
|
-
errors.firstname
|
|
145
|
-
? formatMessage({
|
|
146
|
-
id: errors.firstname,
|
|
147
|
-
defaultMessage: 'This value is required.',
|
|
148
|
-
})
|
|
149
|
-
: undefined
|
|
150
|
-
}
|
|
151
|
-
onChange={handleChange}
|
|
152
|
-
label={formatMessage({
|
|
153
|
-
id: 'Auth.form.firstname.label',
|
|
154
|
-
defaultMessage: 'Firstname',
|
|
136
|
+
{({ values, errors, handleChange }) => {
|
|
137
|
+
return (
|
|
138
|
+
<Form noValidate>
|
|
139
|
+
<Main>
|
|
140
|
+
<Column>
|
|
141
|
+
<Logo />
|
|
142
|
+
<Box paddingTop={6} paddingBottom={1}>
|
|
143
|
+
<Typography as="h1" variant="alpha">
|
|
144
|
+
{formatMessage({
|
|
145
|
+
id: 'Auth.form.welcome.title',
|
|
146
|
+
defaultMessage: 'Welcome!',
|
|
155
147
|
})}
|
|
156
|
-
|
|
157
|
-
</
|
|
158
|
-
<
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
id: 'Auth.form.lastname.label',
|
|
165
|
-
defaultMessage: 'Lastname',
|
|
148
|
+
</Typography>
|
|
149
|
+
</Box>
|
|
150
|
+
<CenteredBox paddingBottom={7}>
|
|
151
|
+
<Typography variant="epsilon" textColor="neutral600">
|
|
152
|
+
{formatMessage({
|
|
153
|
+
id: 'Auth.form.register.subtitle',
|
|
154
|
+
defaultMessage:
|
|
155
|
+
'Your credentials are only used to authenticate yourself on the admin panel. All saved data will be stored in your own database.',
|
|
166
156
|
})}
|
|
167
|
-
|
|
168
|
-
</
|
|
169
|
-
</
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
value={values.confirmPassword}
|
|
240
|
-
error={
|
|
241
|
-
errors.confirmPassword
|
|
242
|
-
? formatMessage({
|
|
243
|
-
id: errors.confirmPassword,
|
|
244
|
-
defaultMessage: 'This value is required.',
|
|
245
|
-
})
|
|
246
|
-
: undefined
|
|
247
|
-
}
|
|
248
|
-
endAction={
|
|
249
|
-
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
250
|
-
<FieldActionWrapper
|
|
251
|
-
onClick={e => {
|
|
252
|
-
e.preventDefault();
|
|
253
|
-
setConfirmPasswordShown(prev => !prev);
|
|
254
|
-
}}
|
|
255
|
-
label={formatMessage(
|
|
256
|
-
confirmPasswordShown
|
|
257
|
-
? {
|
|
258
|
-
id: 'Auth.form.password.show-password',
|
|
259
|
-
defaultMessage: 'Show password',
|
|
260
|
-
}
|
|
261
|
-
: {
|
|
262
|
-
id: 'Auth.form.password.hide-password',
|
|
263
|
-
defaultMessage: 'Hide password',
|
|
264
|
-
}
|
|
265
|
-
)}
|
|
266
|
-
>
|
|
267
|
-
{confirmPasswordShown ? <Eye /> : <EyeStriked />}
|
|
268
|
-
</FieldActionWrapper>
|
|
269
|
-
}
|
|
270
|
-
required
|
|
271
|
-
label={formatMessage({
|
|
272
|
-
id: 'Auth.form.confirmPassword.label',
|
|
273
|
-
defaultMessage: 'Confirmation Password',
|
|
274
|
-
})}
|
|
275
|
-
type={confirmPasswordShown ? 'text' : 'password'}
|
|
276
|
-
/>
|
|
277
|
-
{/* Experiment only until the next release
|
|
278
|
-
To uncomment then */}
|
|
279
|
-
{/* <Checkbox
|
|
280
|
-
onValueChange={checked => {
|
|
281
|
-
handleChange({ target: { value: checked, name: 'news' } });
|
|
282
|
-
}}
|
|
283
|
-
value={values.news}
|
|
284
|
-
name="news"
|
|
285
|
-
aria-label="news"
|
|
286
|
-
>
|
|
287
|
-
{formatMessage(
|
|
288
|
-
{
|
|
289
|
-
id: 'Auth.form.register.news.label',
|
|
157
|
+
</Typography>
|
|
158
|
+
</CenteredBox>
|
|
159
|
+
</Column>
|
|
160
|
+
<Stack spacing={7}>
|
|
161
|
+
<Grid gap={4}>
|
|
162
|
+
<GridItem col={6}>
|
|
163
|
+
<TextInput
|
|
164
|
+
name="firstname"
|
|
165
|
+
required
|
|
166
|
+
value={values.firstname}
|
|
167
|
+
error={errors.firstname ? formatMessage(errors.firstname) : undefined}
|
|
168
|
+
onChange={handleChange}
|
|
169
|
+
label={formatMessage({
|
|
170
|
+
id: 'Auth.form.firstname.label',
|
|
171
|
+
defaultMessage: 'Firstname',
|
|
172
|
+
})}
|
|
173
|
+
/>
|
|
174
|
+
</GridItem>
|
|
175
|
+
<GridItem col={6}>
|
|
176
|
+
<TextInput
|
|
177
|
+
name="lastname"
|
|
178
|
+
value={values.lastname}
|
|
179
|
+
onChange={handleChange}
|
|
180
|
+
label={formatMessage({
|
|
181
|
+
id: 'Auth.form.lastname.label',
|
|
182
|
+
defaultMessage: 'Lastname',
|
|
183
|
+
})}
|
|
184
|
+
/>
|
|
185
|
+
</GridItem>
|
|
186
|
+
</Grid>
|
|
187
|
+
<TextInput
|
|
188
|
+
name="email"
|
|
189
|
+
disabled={fieldsToDisable.includes('email')}
|
|
190
|
+
value={values.email}
|
|
191
|
+
onChange={handleChange}
|
|
192
|
+
error={errors.email ? formatMessage(errors.email) : undefined}
|
|
193
|
+
required
|
|
194
|
+
label={formatMessage({
|
|
195
|
+
id: 'Auth.form.email.label',
|
|
196
|
+
defaultMessage: 'Email',
|
|
197
|
+
})}
|
|
198
|
+
type="email"
|
|
199
|
+
/>
|
|
200
|
+
<PasswordInput
|
|
201
|
+
name="password"
|
|
202
|
+
onChange={handleChange}
|
|
203
|
+
value={values.password}
|
|
204
|
+
error={errors.password ? formatMessage(errors.password) : undefined}
|
|
205
|
+
endAction={
|
|
206
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
207
|
+
<FieldActionWrapper
|
|
208
|
+
onClick={e => {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
setPasswordShown(prev => !prev);
|
|
211
|
+
}}
|
|
212
|
+
label={formatMessage(
|
|
213
|
+
passwordShown
|
|
214
|
+
? {
|
|
215
|
+
id: 'Auth.form.password.show-password',
|
|
216
|
+
defaultMessage: 'Show password',
|
|
217
|
+
}
|
|
218
|
+
: {
|
|
219
|
+
id: 'Auth.form.password.hide-password',
|
|
220
|
+
defaultMessage: 'Hide password',
|
|
221
|
+
}
|
|
222
|
+
)}
|
|
223
|
+
>
|
|
224
|
+
{passwordShown ? <Eye /> : <EyeStriked />}
|
|
225
|
+
</FieldActionWrapper>
|
|
226
|
+
}
|
|
227
|
+
hint={formatMessage({
|
|
228
|
+
id: 'Auth.form.password.hint',
|
|
290
229
|
defaultMessage:
|
|
291
|
-
'
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
230
|
+
'Password must contain at least 8 characters, 1 uppercase, 1 lowercase and 1 number',
|
|
231
|
+
})}
|
|
232
|
+
required
|
|
233
|
+
label={formatMessage({
|
|
234
|
+
id: 'Auth.form.password.label',
|
|
235
|
+
defaultMessage: 'Password',
|
|
236
|
+
})}
|
|
237
|
+
type={passwordShown ? 'text' : 'password'}
|
|
238
|
+
/>
|
|
239
|
+
<PasswordInput
|
|
240
|
+
name="confirmPassword"
|
|
241
|
+
onChange={handleChange}
|
|
242
|
+
value={values.confirmPassword}
|
|
243
|
+
error={
|
|
244
|
+
errors.confirmPassword ? formatMessage(errors.confirmPassword) : undefined
|
|
245
|
+
}
|
|
246
|
+
endAction={
|
|
247
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
248
|
+
<FieldActionWrapper
|
|
249
|
+
onClick={e => {
|
|
250
|
+
e.preventDefault();
|
|
251
|
+
setConfirmPasswordShown(prev => !prev);
|
|
252
|
+
}}
|
|
253
|
+
label={formatMessage(
|
|
254
|
+
confirmPasswordShown
|
|
255
|
+
? {
|
|
256
|
+
id: 'Auth.form.password.show-password',
|
|
257
|
+
defaultMessage: 'Show password',
|
|
258
|
+
}
|
|
259
|
+
: {
|
|
260
|
+
id: 'Auth.form.password.hide-password',
|
|
261
|
+
defaultMessage: 'Hide password',
|
|
262
|
+
}
|
|
263
|
+
)}
|
|
264
|
+
>
|
|
265
|
+
{confirmPasswordShown ? <Eye /> : <EyeStriked />}
|
|
266
|
+
</FieldActionWrapper>
|
|
310
267
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
268
|
+
required
|
|
269
|
+
label={formatMessage({
|
|
270
|
+
id: 'Auth.form.confirmPassword.label',
|
|
271
|
+
defaultMessage: 'Confirmation Password',
|
|
272
|
+
})}
|
|
273
|
+
type={confirmPasswordShown ? 'text' : 'password'}
|
|
274
|
+
/>
|
|
275
|
+
<Checkbox
|
|
276
|
+
onValueChange={checked => {
|
|
277
|
+
handleChange({ target: { value: checked, name: 'news' } });
|
|
278
|
+
}}
|
|
279
|
+
value={values.news}
|
|
280
|
+
name="news"
|
|
281
|
+
aria-label="news"
|
|
282
|
+
>
|
|
283
|
+
{formatMessage(
|
|
284
|
+
{
|
|
285
|
+
id: 'Auth.form.register.news.label',
|
|
286
|
+
defaultMessage:
|
|
287
|
+
'Keep me updated about the new features and upcoming improvements (by doing this you accept the {terms} and the {policy}).',
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
terms: (
|
|
291
|
+
<A target="_blank" href="https://strapi.io/terms" rel="noreferrer">
|
|
292
|
+
{formatMessage({
|
|
293
|
+
id: 'Auth.privacy-policy-agreement.terms',
|
|
294
|
+
defaultMessage: 'terms',
|
|
295
|
+
})}
|
|
296
|
+
</A>
|
|
297
|
+
),
|
|
298
|
+
policy: (
|
|
299
|
+
<A target="_blank" href="https://strapi.io/privacy" rel="noreferrer">
|
|
300
|
+
{formatMessage({
|
|
301
|
+
id: 'Auth.privacy-policy-agreement.policy',
|
|
302
|
+
defaultMessage: 'policy',
|
|
303
|
+
})}
|
|
304
|
+
</A>
|
|
305
|
+
),
|
|
306
|
+
}
|
|
307
|
+
)}
|
|
308
|
+
</Checkbox>
|
|
309
|
+
<Button fullWidth size="L" type="submit">
|
|
310
|
+
{formatMessage({
|
|
311
|
+
id: 'Auth.form.button.register',
|
|
312
|
+
defaultMessage: "Let's start",
|
|
313
|
+
})}
|
|
314
|
+
</Button>
|
|
315
|
+
</Stack>
|
|
316
|
+
</Main>
|
|
317
|
+
</Form>
|
|
318
|
+
);
|
|
319
|
+
}}
|
|
323
320
|
</Formik>
|
|
324
321
|
{!noSignin && (
|
|
325
322
|
<Box paddingTop={4}>
|
|
@@ -345,10 +342,14 @@ Register.defaultProps = {
|
|
|
345
342
|
};
|
|
346
343
|
|
|
347
344
|
Register.propTypes = {
|
|
345
|
+
authType: PropTypes.string.isRequired,
|
|
348
346
|
fieldsToDisable: PropTypes.array,
|
|
349
347
|
noSignin: PropTypes.bool,
|
|
350
348
|
onSubmit: PropTypes.func,
|
|
351
|
-
schema: PropTypes.shape({
|
|
349
|
+
schema: PropTypes.shape({
|
|
350
|
+
validate: PropTypes.func.isRequired,
|
|
351
|
+
type: PropTypes.string.isRequired,
|
|
352
|
+
}).isRequired,
|
|
352
353
|
};
|
|
353
354
|
|
|
354
355
|
export default Register;
|
|
@@ -18,7 +18,7 @@ import UnauthenticatedLayout, {
|
|
|
18
18
|
Column,
|
|
19
19
|
LayoutContent,
|
|
20
20
|
} from '../../../../layouts/UnauthenticatedLayout';
|
|
21
|
-
import Logo from '
|
|
21
|
+
import Logo from '../../../../components/UnauthenticatedLogo';
|
|
22
22
|
import FieldActionWrapper from '../FieldActionWrapper';
|
|
23
23
|
|
|
24
24
|
const PasswordInput = styled(TextInput)`
|
|
@@ -73,7 +73,7 @@ const ForgotPassword = ({ onSubmit, schema }) => {
|
|
|
73
73
|
)}
|
|
74
74
|
</Column>
|
|
75
75
|
|
|
76
|
-
<Stack
|
|
76
|
+
<Stack spacing={6}>
|
|
77
77
|
<PasswordInput
|
|
78
78
|
name="password"
|
|
79
79
|
onChange={handleChange}
|
|
@@ -4,7 +4,7 @@ import camelCase from 'lodash/camelCase';
|
|
|
4
4
|
import get from 'lodash/get';
|
|
5
5
|
import omit from 'lodash/omit';
|
|
6
6
|
import { Redirect, useRouteMatch, useHistory } from 'react-router-dom';
|
|
7
|
-
import { auth, useQuery, useGuidedTour } from '@strapi/helper-plugin';
|
|
7
|
+
import { auth, useQuery, useGuidedTour, useTracking } from '@strapi/helper-plugin';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import forms from 'ee_else_ce/pages/AuthPage/utils/forms';
|
|
10
10
|
import persistStateToLocaleStorage from '../../components/GuidedTour/utils/persistStateToLocaleStorage';
|
|
@@ -17,6 +17,7 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
|
|
|
17
17
|
const { push } = useHistory();
|
|
18
18
|
const { changeLocale } = useLocalesProvider();
|
|
19
19
|
const { setSkipped } = useGuidedTour();
|
|
20
|
+
const { trackUsage } = useTracking();
|
|
20
21
|
const {
|
|
21
22
|
params: { authType },
|
|
22
23
|
} = useRouteMatch('/auth/:authType');
|
|
@@ -146,6 +147,8 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
|
|
|
146
147
|
|
|
147
148
|
const registerRequest = async (body, requestURL, { setSubmitting, setErrors }) => {
|
|
148
149
|
try {
|
|
150
|
+
trackUsage('willCreateFirstAdmin');
|
|
151
|
+
|
|
149
152
|
const {
|
|
150
153
|
data: {
|
|
151
154
|
data: { token, user },
|
|
@@ -160,22 +163,6 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
|
|
|
160
163
|
auth.setToken(token, false);
|
|
161
164
|
auth.setUserInfo(user, false);
|
|
162
165
|
|
|
163
|
-
if (
|
|
164
|
-
(authType === 'register' && body.userInfo.news === true) ||
|
|
165
|
-
(authType === 'register-admin' && body.news === true)
|
|
166
|
-
) {
|
|
167
|
-
axios({
|
|
168
|
-
method: 'POST',
|
|
169
|
-
url: 'https://analytics.strapi.io/register',
|
|
170
|
-
data: {
|
|
171
|
-
email: user.email,
|
|
172
|
-
username: user.firstname,
|
|
173
|
-
firstAdmin: !hasAdmin,
|
|
174
|
-
},
|
|
175
|
-
cancelToken: source.token,
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
// Redirect to the homePage
|
|
179
166
|
setSubmitting(false);
|
|
180
167
|
setHasAdmin(true);
|
|
181
168
|
|
|
@@ -190,8 +177,23 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
|
|
|
190
177
|
}
|
|
191
178
|
}
|
|
192
179
|
|
|
180
|
+
if (
|
|
181
|
+
(authType === 'register' && body.userInfo.news === true) ||
|
|
182
|
+
(authType === 'register-admin' && body.news === true)
|
|
183
|
+
) {
|
|
184
|
+
push({
|
|
185
|
+
pathname: '/usecase',
|
|
186
|
+
search: `?hasAdmin=${hasAdmin}`,
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Redirect to the homePage
|
|
193
193
|
push('/');
|
|
194
194
|
} catch (err) {
|
|
195
|
+
trackUsage('didNotCreateFirstAdmin');
|
|
196
|
+
|
|
195
197
|
if (err.response) {
|
|
196
198
|
const { data } = err.response;
|
|
197
199
|
const apiErrors = formatAPIErrors(data);
|
|
@@ -252,6 +254,7 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
|
|
|
252
254
|
return (
|
|
253
255
|
<Component
|
|
254
256
|
{...rest}
|
|
257
|
+
authType={authType}
|
|
255
258
|
fieldsToDisable={fieldsToDisable}
|
|
256
259
|
formErrors={formErrors}
|
|
257
260
|
inputsPrefix={inputsPrefix}
|
|
@@ -23,7 +23,7 @@ const HomeHeader = ({ hasCreatedContentType, onCreateCT }) => {
|
|
|
23
23
|
return (
|
|
24
24
|
<div>
|
|
25
25
|
<Box paddingLeft={6} paddingBottom={10}>
|
|
26
|
-
<StackCustom
|
|
26
|
+
<StackCustom spacing={5}>
|
|
27
27
|
<Typography as="h1" variant="alpha">
|
|
28
28
|
{hasCreatedContentType
|
|
29
29
|
? formatMessage({
|
|
@@ -30,9 +30,6 @@ const StyledReddit = styled(Reddit)`
|
|
|
30
30
|
> path:first-child {
|
|
31
31
|
fill: #ff4500;
|
|
32
32
|
}
|
|
33
|
-
> path:last-child {
|
|
34
|
-
fill: ${({ theme }) => theme.colors.neutral0};
|
|
35
|
-
}
|
|
36
33
|
`;
|
|
37
34
|
const StyledStrapi = styled(Strapi)`
|
|
38
35
|
> path:first-child {
|
|
@@ -154,8 +151,8 @@ const SocialLinks = () => {
|
|
|
154
151
|
shadow="tableShadow"
|
|
155
152
|
>
|
|
156
153
|
<Box paddingBottom={7}>
|
|
157
|
-
<Stack
|
|
158
|
-
<Stack
|
|
154
|
+
<Stack spacing={5}>
|
|
155
|
+
<Stack spacing={3}>
|
|
159
156
|
<Typography variant="delta" as="h2" id="join-the-community">
|
|
160
157
|
{formatMessage({
|
|
161
158
|
id: 'app.components.HomePage.community',
|