mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Fix PR feedback
Signed-off-by: HichamELBSI <elabbassih@gmail.com>
This commit is contained in:
parent
ad4cad32a0
commit
f568ce08bd
@ -1,7 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const GoogleStrategy = require('passport-google-oauth2');
|
||||
|
||||
module.exports = ({ env }) => ({
|
||||
host: env('HOST', '0.0.0.0'),
|
||||
port: env.int('PORT', 1337),
|
||||
@ -9,32 +5,6 @@ module.exports = ({ env }) => ({
|
||||
// autoOpen: true,
|
||||
auth: {
|
||||
secret: env('ADMIN_JWT_SECRET', 'example-token'),
|
||||
providers: [
|
||||
{
|
||||
uid: 'google',
|
||||
displayName: 'Google',
|
||||
icon: 'https://cdn2.iconfinder.com/data/icons/social-icons-33/128/Google-512.png',
|
||||
createStrategy: strapi =>
|
||||
new GoogleStrategy(
|
||||
{
|
||||
clientID: env('GOOGLE_CLIENT_ID'),
|
||||
clientSecret: env('GOOGLE_CLIENT_SECRET'),
|
||||
scope: [
|
||||
'https://www.googleapis.com/auth/userinfo.email',
|
||||
'https://www.googleapis.com/auth/userinfo.profile',
|
||||
],
|
||||
callbackURL: strapi.admin.services.passport.getStrategyCallbackURL('google'),
|
||||
},
|
||||
(request, accessToken, refreshToken, profile, done) => {
|
||||
done(null, {
|
||||
email: profile.email,
|
||||
firstname: profile.given_name,
|
||||
lastname: profile.family_name,
|
||||
});
|
||||
}
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
import styled from 'styled-components';
|
||||
import { Button } from '@strapi/parts/Button';
|
||||
|
||||
const AuthButton = styled(Button)`
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
export default AuthButton;
|
||||
@ -0,0 +1,14 @@
|
||||
import styled from 'styled-components';
|
||||
import { FieldAction } from '@strapi/parts/Field';
|
||||
|
||||
const FieldActionWrapper = styled(FieldAction)`
|
||||
svg {
|
||||
height: 1rem;
|
||||
width: 1rem;
|
||||
path {
|
||||
fill: ${({ theme }) => theme.colors.neutral600};
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export default FieldActionWrapper;
|
||||
@ -6,36 +6,21 @@ import {
|
||||
H1,
|
||||
Text,
|
||||
Subtitle,
|
||||
Button,
|
||||
Checkbox,
|
||||
TextInput,
|
||||
Main,
|
||||
FieldAction,
|
||||
Row,
|
||||
Link,
|
||||
} from '@strapi/parts';
|
||||
import { Form } from '@strapi/helper-plugin';
|
||||
import PropTypes from 'prop-types';
|
||||
import styled from 'styled-components';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { Formik } from 'formik';
|
||||
|
||||
import { Column, LayoutContent } from '../../../../layouts/UnauthenticatedLayout';
|
||||
import Form from '../../../../components/Form';
|
||||
import Logo from '../Logo';
|
||||
|
||||
const AuthButton = styled(Button)`
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
`;
|
||||
const FieldActionWrapper = styled(FieldAction)`
|
||||
svg {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
path {
|
||||
fill: ${({ theme }) => theme.colors.neutral600};
|
||||
}
|
||||
}
|
||||
`;
|
||||
import AuthButton from '../AuthButton';
|
||||
import FieldActionWrapper from '../FieldActionWrapper';
|
||||
|
||||
const Login = ({ onSubmit, schema, children }) => {
|
||||
const [passwordShown, setPasswordShown] = useState(false);
|
||||
@ -92,7 +77,6 @@ const Login = ({ onSubmit, schema, children }) => {
|
||||
name="password"
|
||||
type={passwordShown ? 'text' : 'password'}
|
||||
endAction={
|
||||
// eslint-disable-next-line react/jsx-wrap-multilines
|
||||
<FieldActionWrapper
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
|
||||
@ -12,42 +12,31 @@ import {
|
||||
Grid,
|
||||
GridItem,
|
||||
Checkbox,
|
||||
Button,
|
||||
FieldAction,
|
||||
Link,
|
||||
Row,
|
||||
} from '@strapi/parts';
|
||||
import { Form } from '@strapi/helper-plugin';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Formik } from 'formik';
|
||||
import Form from '../../../../components/Form';
|
||||
import UnauthenticatedLayout, {
|
||||
Column,
|
||||
LayoutContent,
|
||||
} from '../../../../layouts/UnauthenticatedLayout';
|
||||
import { useConfigurations } from '../../../../hooks';
|
||||
import Logo from '../Logo';
|
||||
import AuthButton from '../AuthButton';
|
||||
import FieldActionWrapper from '../FieldActionWrapper';
|
||||
|
||||
const AuthButton = styled(Button)`
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
`;
|
||||
const CenteredBox = styled(Box)`
|
||||
text-align: center;
|
||||
`;
|
||||
const FieldActionWrapper = styled(FieldAction)`
|
||||
svg {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
path {
|
||||
fill: ${({ theme }) => theme.colors.neutral600};
|
||||
}
|
||||
}
|
||||
const A = styled.a`
|
||||
color: ${({ theme }) => theme.colors.primary600};
|
||||
`;
|
||||
|
||||
const Register = ({ fieldsToDisable, noSignin, onSubmit, modifiedData, schema }) => {
|
||||
const [passwordShown, setPasswordShown] = useState(false);
|
||||
const [confirmPasswordShown, setConfirmPasswordShown] = useState(false);
|
||||
const { formatMessage } = useIntl();
|
||||
const { authLogo } = useConfigurations();
|
||||
|
||||
return (
|
||||
<UnauthenticatedLayout>
|
||||
@ -71,12 +60,12 @@ const Register = ({ fieldsToDisable, noSignin, onSubmit, modifiedData, schema })
|
||||
<Form noValidate>
|
||||
<Main labelledBy="welcome">
|
||||
<Column>
|
||||
<img src={authLogo} alt="" aria-hidden style={{ height: '72px' }} />
|
||||
<Logo />
|
||||
<Box paddingTop="6" paddingBottom="1">
|
||||
<H1 id="welcome">{formatMessage({ id: 'Auth.form.welcome.title' })}</H1>
|
||||
</Box>
|
||||
<CenteredBox paddingBottom="7">
|
||||
<Subtitle style={{ textAlign: 'center' }} textColor="neutral600">
|
||||
<Subtitle textColor="neutral600">
|
||||
{formatMessage({ id: 'Auth.form.register.subtitle' })}
|
||||
</Subtitle>
|
||||
</CenteredBox>
|
||||
@ -88,7 +77,9 @@ const Register = ({ fieldsToDisable, noSignin, onSubmit, modifiedData, schema })
|
||||
name="firstname"
|
||||
required
|
||||
value={values.firstname}
|
||||
error={errors.firstname ? formatMessage({ id: errors.firstname }) : ''}
|
||||
error={
|
||||
errors.firstname ? formatMessage({ id: errors.firstname }) : undefined
|
||||
}
|
||||
onChange={handleChange}
|
||||
label={formatMessage({ id: 'Auth.form.firstname.label' })}
|
||||
/>
|
||||
@ -96,7 +87,7 @@ const Register = ({ fieldsToDisable, noSignin, onSubmit, modifiedData, schema })
|
||||
<GridItem col={6}>
|
||||
<TextInput
|
||||
name="lastname"
|
||||
error={errors.lastname ? formatMessage({ id: errors.lastname }) : ''}
|
||||
error={errors.lastname ? formatMessage({ id: errors.lastname }) : undefined}
|
||||
required
|
||||
value={values.lastname}
|
||||
onChange={handleChange}
|
||||
@ -109,7 +100,7 @@ const Register = ({ fieldsToDisable, noSignin, onSubmit, modifiedData, schema })
|
||||
disabled={fieldsToDisable.includes('email')}
|
||||
value={values.email}
|
||||
onChange={handleChange}
|
||||
error={errors.email ? formatMessage({ id: errors.email }) : ''}
|
||||
error={errors.email ? formatMessage({ id: errors.email }) : undefined}
|
||||
required
|
||||
label={formatMessage({ id: 'Auth.form.email.label' })}
|
||||
type="email"
|
||||
@ -118,9 +109,8 @@ const Register = ({ fieldsToDisable, noSignin, onSubmit, modifiedData, schema })
|
||||
name="password"
|
||||
onChange={handleChange}
|
||||
value={values.password}
|
||||
error={errors.password ? formatMessage({ id: errors.password }) : ''}
|
||||
error={errors.password ? formatMessage({ id: errors.password }) : undefined}
|
||||
endAction={
|
||||
// eslint-disable-next-line react/jsx-wrap-multilines
|
||||
<FieldActionWrapper
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
@ -144,10 +134,11 @@ const Register = ({ fieldsToDisable, noSignin, onSubmit, modifiedData, schema })
|
||||
onChange={handleChange}
|
||||
value={values.confirmPassword}
|
||||
error={
|
||||
errors.confirmPassword ? formatMessage({ id: errors.confirmPassword }) : ''
|
||||
errors.confirmPassword
|
||||
? formatMessage({ id: errors.confirmPassword })
|
||||
: undefined
|
||||
}
|
||||
endAction={
|
||||
// eslint-disable-next-line react/jsx-wrap-multilines
|
||||
<FieldActionWrapper
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
@ -177,14 +168,14 @@ const Register = ({ fieldsToDisable, noSignin, onSubmit, modifiedData, schema })
|
||||
{ id: 'Auth.form.register.news.label' },
|
||||
{
|
||||
terms: (
|
||||
<a target="_blank" href="https://strapi.io/terms" rel="noreferrer">
|
||||
<A target="_blank" href="https://strapi.io/terms" rel="noreferrer">
|
||||
{formatMessage({ id: 'Auth.privacy-policy-agreement.terms' })}
|
||||
</a>
|
||||
</A>
|
||||
),
|
||||
policy: (
|
||||
<a target="_blank" href="https://strapi.io/privacy" rel="noreferrer">
|
||||
<A target="_blank" href="https://strapi.io/privacy" rel="noreferrer">
|
||||
{formatMessage({ id: 'Auth.privacy-policy-agreement.policy' })}
|
||||
</a>
|
||||
</A>
|
||||
),
|
||||
}
|
||||
)}
|
||||
|
||||
@ -7,7 +7,6 @@ import {
|
||||
Row,
|
||||
Box,
|
||||
TableLabel,
|
||||
Button,
|
||||
Main,
|
||||
Subtitle,
|
||||
H1,
|
||||
@ -23,14 +22,11 @@ import UnauthenticatedLayout, {
|
||||
} from '../../../../../../admin/src/layouts/UnauthenticatedLayout';
|
||||
import SSOProviders from './SSOProviders';
|
||||
import Logo from '../../../../../../admin/src/pages/AuthPage/components/Logo';
|
||||
import AuthButton from '../../../../../../admin/src/pages/AuthPage/components/AuthButton';
|
||||
|
||||
const DividerFull = styled(Divider)`
|
||||
flex: 1;
|
||||
`;
|
||||
const AuthButton = styled(Button)`
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
const Providers = () => {
|
||||
const ssoEnabled = strapi.features.isEnabled(strapi.features.SSO);
|
||||
|
||||
@ -41,8 +41,8 @@
|
||||
"@strapi/babel-plugin-switch-ee-ce": "1.0.0",
|
||||
"@strapi/helper-plugin": "3.6.6",
|
||||
"@strapi/utils": "3.6.6",
|
||||
"@strapi/icons": "0.0.1-alpha.10",
|
||||
"@strapi/parts": "0.0.1-alpha.10",
|
||||
"@strapi/icons": "0.0.1-alpha.11",
|
||||
"@strapi/parts": "0.0.1-alpha.11",
|
||||
"axios": "^0.21.1",
|
||||
"babel-loader": "8.2.2",
|
||||
"babel-plugin-styled-components": "1.12.0",
|
||||
|
||||
@ -23,6 +23,7 @@ export { default as HeaderSearch } from './components/HeaderSearch';
|
||||
export { default as IcoContainer } from './components/IcoContainer';
|
||||
export { default as InputAddon } from './components/InputAddon';
|
||||
export { default as EmptyState } from './components/EmptyState';
|
||||
export { default as Form } from './components/Form';
|
||||
export * from './components/Tabs';
|
||||
export * from './components/Select';
|
||||
|
||||
|
||||
@ -73,6 +73,7 @@
|
||||
"babel-plugin-styled-components": "1.12.0",
|
||||
"bootstrap": "^4.6.0",
|
||||
"classnames": "^2.3.1",
|
||||
"formik": "2.2.9",
|
||||
"immutable": "^3.8.2",
|
||||
"invariant": "^2.2.1",
|
||||
"lodash": "4.17.21",
|
||||
|
||||
18
yarn.lock
18
yarn.lock
@ -3497,15 +3497,15 @@
|
||||
tslib "^2.0.0"
|
||||
upath "2.0.1"
|
||||
|
||||
"@strapi/icons@0.0.1-alpha.10":
|
||||
version "0.0.1-alpha.10"
|
||||
resolved "https://registry.yarnpkg.com/@strapi/icons/-/icons-0.0.1-alpha.10.tgz#ec7424718abeb2d6680c91c7ba666ffbaa7f43e8"
|
||||
integrity sha512-VbMDJuYl6xwG6COOF6BheXy1JIboWpyO8QqqfhJoJBLcAGVrouUeUMp+YGOsyi9nnGtPZSs8TNdtMkHkstRHqA==
|
||||
"@strapi/icons@0.0.1-alpha.11":
|
||||
version "0.0.1-alpha.11"
|
||||
resolved "https://registry.yarnpkg.com/@strapi/icons/-/icons-0.0.1-alpha.11.tgz#a92b27f8f3fd6081249c07c6acc6e4aefe38bd68"
|
||||
integrity sha512-BTl/2bGzCaVqhwj/vcmicL4Ya19J6NZ4A3O8MDDogoRwaDfHceLT1RpzKsID4x4kfXasopbNST1GzrJ2pvz9mw==
|
||||
|
||||
"@strapi/parts@0.0.1-alpha.10":
|
||||
version "0.0.1-alpha.10"
|
||||
resolved "https://registry.yarnpkg.com/@strapi/parts/-/parts-0.0.1-alpha.10.tgz#dfed27fc2fb73423af896109b2e3280c5473260a"
|
||||
integrity sha512-WosaWkioUDucF5R1LC5qP76hAs2abKuL3HaiCUgvIudomItMrPRxman2LPYjGzFfFXPKu6aJwNy5CXMx6owRpw==
|
||||
"@strapi/parts@0.0.1-alpha.11":
|
||||
version "0.0.1-alpha.11"
|
||||
resolved "https://registry.yarnpkg.com/@strapi/parts/-/parts-0.0.1-alpha.11.tgz#ad42d40d979cabe73df4815faf2c65629a9b497d"
|
||||
integrity sha512-tyPPZm0QIPh/hSMvtei0hum2S2XM3WmFALOXNGI8rSOyGLYnRzWf+phlyUNOYYuyxwEeNIR3vU+w3n7xpRpXiQ==
|
||||
dependencies:
|
||||
"@internationalized/number" "^3.0.2"
|
||||
compute-scroll-into-view "^1.0.17"
|
||||
@ -9605,7 +9605,7 @@ formidable@^1.1.1, formidable@^1.2.2:
|
||||
resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.2.2.tgz#bf69aea2972982675f00865342b982986f6b8dd9"
|
||||
integrity sha512-V8gLm+41I/8kguQ4/o1D3RIHRmhYFG4pnNyonvua+40rqcEmT4+V71yaZ3B457xbbgCsCfjSPi65u/W6vK1U5Q==
|
||||
|
||||
formik@^2.2.6:
|
||||
formik@2.2.9, formik@^2.2.6:
|
||||
version "2.2.9"
|
||||
resolved "https://registry.yarnpkg.com/formik/-/formik-2.2.9.tgz#8594ba9c5e2e5cf1f42c5704128e119fc46232d0"
|
||||
integrity sha512-LQLcISMmf1r5at4/gyJigGn0gOwFbeEAlji+N9InZF6LIMXnFNkO42sCI8Jt84YZggpD4cPWObAZaxpEFtSzNA==
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user