@strapi/admin 4.1.3 → 4.2.0-alpha.0
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/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/AuthPage/components/ForgotPassword/index.js +1 -1
- package/admin/src/pages/AuthPage/components/Login/BaseLogin.js +1 -1
- package/admin/src/pages/AuthPage/components/Register/index.js +219 -214
- package/admin/src/pages/AuthPage/components/ResetPassword/index.js +1 -1
- package/admin/src/pages/AuthPage/index.js +7 -1
- 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 +2 -2
- 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 +1 -1
- package/admin/src/translations/en.json +5 -2
- package/build/{1094.1087a368.chunk.js → 1094.e1db3a1a.chunk.js} +1 -1
- package/build/1454.f065d92a.chunk.js +2 -0
- package/build/{1454.c0f0c2df.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.53cd9bba.chunk.js → 9260.fa40c7bd.chunk.js} +2 -2
- package/build/{2736.53cd9bba.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.00b65530.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.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.b35c285f.chunk.js +1 -0
- 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.d710de1b.js +2 -0
- package/build/{main.2667673b.js.LICENSE.txt → main.d710de1b.js.LICENSE.txt} +0 -0
- package/build/runtime~main.fb5daee1.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 +1 -1
- package/ee/admin/pages/SettingsPage/SingleSignOn/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Roles/CreatePage/index.js +3 -3
- 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/1454.c0f0c2df.chunk.js +0 -2
- package/build/1856.a06395b4.chunk.js +0 -1
- package/build/2481.7d15bd79.chunk.js +0 -1
- package/build/4362.70618acb.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/6250.dc6d7a58.chunk.js +0 -1
- package/build/849.9075d399.chunk.js +0 -1
- package/build/9853.b75be3f0.chunk.js +0 -1
- package/build/Admin-authenticatedApp.872a6e3b.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.5544bc9f.chunk.js +0 -1
- package/build/en-json.5aa9e5ec.chunk.js +0 -1
- package/build/i18n-settings-page.51e37957.chunk.js +0 -1
- package/build/main.2667673b.js +0 -2
- package/build/runtime~main.4b356df3.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.f3e86700.chunk.js +0 -1
- package/build/users-roles-settings-page.b67e2b4d.chunk.js +0 -1
- package/build/webhook-edit-page.b2e22743.chunk.js +0 -1
|
@@ -15,7 +15,13 @@ 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';
|
|
@@ -41,12 +47,14 @@ const PasswordInput = styled(TextInput)`
|
|
|
41
47
|
}
|
|
42
48
|
`;
|
|
43
49
|
|
|
44
|
-
const Register = ({ fieldsToDisable, noSignin, onSubmit, schema }) => {
|
|
50
|
+
const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) => {
|
|
45
51
|
const toggleNotification = useNotification();
|
|
46
52
|
const { push } = useHistory();
|
|
47
53
|
const [passwordShown, setPasswordShown] = useState(false);
|
|
48
54
|
const [confirmPasswordShown, setConfirmPasswordShown] = useState(false);
|
|
55
|
+
const [submitCount, setSubmitCount] = useState(0);
|
|
49
56
|
const [userInfo, setUserInfo] = useState({});
|
|
57
|
+
const { trackUsage } = useTracking();
|
|
50
58
|
const { formatMessage } = useIntl();
|
|
51
59
|
const query = useQuery();
|
|
52
60
|
const registrationToken = query.get('registrationToken');
|
|
@@ -97,225 +105,218 @@ const Register = ({ fieldsToDisable, noSignin, onSubmit, schema }) => {
|
|
|
97
105
|
registrationToken: registrationToken || undefined,
|
|
98
106
|
news: false,
|
|
99
107
|
}}
|
|
100
|
-
onSubmit={(data, formik) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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);
|
|
106
130
|
}
|
|
107
131
|
}}
|
|
108
|
-
|
|
132
|
+
// Leaving this part commented when we remove the tracking for the submitCount
|
|
133
|
+
// validationSchema={schema}
|
|
109
134
|
validateOnChange={false}
|
|
110
135
|
>
|
|
111
|
-
{({ values, errors, handleChange }) =>
|
|
112
|
-
|
|
113
|
-
<
|
|
114
|
-
<
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
</Typography>
|
|
123
|
-
</Box>
|
|
124
|
-
<CenteredBox paddingBottom={7}>
|
|
125
|
-
<Typography variant="epsilon" textColor="neutral600">
|
|
126
|
-
{formatMessage({
|
|
127
|
-
id: 'Auth.form.register.subtitle',
|
|
128
|
-
defaultMessage:
|
|
129
|
-
'Your credentials are only used to authenticate yourself on the admin panel. All saved data will be stored in your own database.',
|
|
130
|
-
})}
|
|
131
|
-
</Typography>
|
|
132
|
-
</CenteredBox>
|
|
133
|
-
</Column>
|
|
134
|
-
<Stack size={7}>
|
|
135
|
-
<Grid gap={4}>
|
|
136
|
-
<GridItem col={6}>
|
|
137
|
-
<TextInput
|
|
138
|
-
name="firstname"
|
|
139
|
-
required
|
|
140
|
-
value={values.firstname}
|
|
141
|
-
error={
|
|
142
|
-
errors.firstname
|
|
143
|
-
? formatMessage({
|
|
144
|
-
id: errors.firstname,
|
|
145
|
-
defaultMessage: 'This value is required.',
|
|
146
|
-
})
|
|
147
|
-
: undefined
|
|
148
|
-
}
|
|
149
|
-
onChange={handleChange}
|
|
150
|
-
label={formatMessage({
|
|
151
|
-
id: 'Auth.form.firstname.label',
|
|
152
|
-
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!',
|
|
153
147
|
})}
|
|
154
|
-
|
|
155
|
-
</
|
|
156
|
-
<
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
id: 'Auth.form.lastname.label',
|
|
163
|
-
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.',
|
|
164
156
|
})}
|
|
165
|
-
|
|
166
|
-
</
|
|
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
|
-
value={values.confirmPassword}
|
|
238
|
-
error={
|
|
239
|
-
errors.confirmPassword
|
|
240
|
-
? formatMessage({
|
|
241
|
-
id: errors.confirmPassword,
|
|
242
|
-
defaultMessage: 'This value is required.',
|
|
243
|
-
})
|
|
244
|
-
: 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>
|
|
267
|
-
}
|
|
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',
|
|
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',
|
|
286
229
|
defaultMessage:
|
|
287
|
-
'
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
defaultMessage: 'policy',
|
|
303
|
-
})}
|
|
304
|
-
</A>
|
|
305
|
-
),
|
|
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
|
|
306
245
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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>
|
|
267
|
+
}
|
|
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
|
+
}}
|
|
319
320
|
</Formik>
|
|
320
321
|
{!noSignin && (
|
|
321
322
|
<Box paddingTop={4}>
|
|
@@ -341,10 +342,14 @@ Register.defaultProps = {
|
|
|
341
342
|
};
|
|
342
343
|
|
|
343
344
|
Register.propTypes = {
|
|
345
|
+
authType: PropTypes.string.isRequired,
|
|
344
346
|
fieldsToDisable: PropTypes.array,
|
|
345
347
|
noSignin: PropTypes.bool,
|
|
346
348
|
onSubmit: PropTypes.func,
|
|
347
|
-
schema: PropTypes.shape({
|
|
349
|
+
schema: PropTypes.shape({
|
|
350
|
+
validate: PropTypes.func.isRequired,
|
|
351
|
+
type: PropTypes.string.isRequired,
|
|
352
|
+
}).isRequired,
|
|
348
353
|
};
|
|
349
354
|
|
|
350
355
|
export default Register;
|
|
@@ -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 },
|
|
@@ -189,6 +192,8 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
|
|
|
189
192
|
// Redirect to the homePage
|
|
190
193
|
push('/');
|
|
191
194
|
} catch (err) {
|
|
195
|
+
trackUsage('didNotCreateFirstAdmin');
|
|
196
|
+
|
|
192
197
|
if (err.response) {
|
|
193
198
|
const { data } = err.response;
|
|
194
199
|
const apiErrors = formatAPIErrors(data);
|
|
@@ -249,6 +254,7 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
|
|
|
249
254
|
return (
|
|
250
255
|
<Component
|
|
251
256
|
{...rest}
|
|
257
|
+
authType={authType}
|
|
252
258
|
fieldsToDisable={fieldsToDisable}
|
|
253
259
|
formErrors={formErrors}
|
|
254
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',
|
|
@@ -56,7 +56,7 @@ const MarketPlacePage = () => {
|
|
|
56
56
|
/>
|
|
57
57
|
<ContentLayout>
|
|
58
58
|
<StackCentered
|
|
59
|
-
|
|
59
|
+
spacing={0}
|
|
60
60
|
hasRadius
|
|
61
61
|
background="neutral0"
|
|
62
62
|
shadow="tableShadow"
|
|
@@ -93,7 +93,7 @@ const MarketPlacePage = () => {
|
|
|
93
93
|
})}
|
|
94
94
|
</CenterTypography>
|
|
95
95
|
</Flex>
|
|
96
|
-
<Stack paddingTop={6} horizontal
|
|
96
|
+
<Stack paddingTop={6} horizontal spacing={2}>
|
|
97
97
|
<LinkButton
|
|
98
98
|
href="https://market.strapi.io"
|
|
99
99
|
size="L"
|