Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/.cache/admin/src/containers/AuthPage/components/Register/ drwxr-xr-x | |
| Viewing file: Select action/file-type: /* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/no-static-element-interactions */
import React from 'react';
import { Checkbox, Flex, Padded, Text } from '@buffetjs/core';
import { useIntl, FormattedMessage } from 'react-intl';
import { get } from 'lodash';
import PropTypes from 'prop-types';
import Button from '../../../../components/FullWidthButton';
import AuthLink from '../AuthLink';
import Input from '../Input';
import Logo from '../Logo';
import Section from '../Section';
import CustomLabel from './CustomLabel';
import Box from '../Box';
import InputWrapper from './InputWrapper';
import Span from './Span';
const Register = ({
fieldsToDisable,
formErrors,
inputsPrefix,
modifiedData,
noSignin,
onChange,
onSubmit,
requestError,
}) => {
const { formatMessage } = useIntl();
const handleClick = (e, to) => {
e.preventDefault();
e.stopPropagation();
const win = window.open(`https://strapi.io/${to}`, '_blank');
win.focus();
};
const terms = (
<FormattedMessage id="Auth.privacy-policy-agreement.terms" key="1">
{content => <Span onClick={e => handleClick(e, 'terms')}>{content}</Span>}
</FormattedMessage>
);
const policy = (
<FormattedMessage id="Auth.privacy-policy-agreement.policy" key="2">
{content => <Span onClick={e => handleClick(e, 'privacy')}>{content}</Span>}
</FormattedMessage>
);
return (
<>
<Section textAlign="center">
<Logo />
</Section>
<Section withBackground>
<Padded top size="25px">
<Box errorMessage={get(requestError, 'errorMessage', null)}>
<form onSubmit={onSubmit}>
<InputWrapper>
<Input
autoFocus
error={formErrors[`${inputsPrefix}firstname`]}
label="Auth.form.firstname.label"
name={`${inputsPrefix}firstname`}
onChange={onChange}
placeholder="Auth.form.firstname.placeholder"
type="text"
validations={{ required: true }}
value={get(modifiedData, `${inputsPrefix}firstname`, '')}
/>
<Input
error={formErrors[`${inputsPrefix}lastname`]}
label="Auth.form.lastname.label"
name={`${inputsPrefix}lastname`}
onChange={onChange}
placeholder="Auth.form.lastname.placeholder"
type="text"
validations={{ required: true }}
value={get(modifiedData, `${inputsPrefix}lastname`, '')}
/>
</InputWrapper>
<Input
error={formErrors[`${inputsPrefix}email`]}
disabled={fieldsToDisable.includes('email')}
label="Auth.form.email.label"
name={`${inputsPrefix}email`}
onChange={onChange}
placeholder="Auth.form.email.placeholder"
type="email"
validations={{ required: true }}
value={get(modifiedData, `${inputsPrefix}email`, '')}
/>
<Input
error={formErrors[`${inputsPrefix}password`]}
label="Auth.form.password.label"
name={`${inputsPrefix}password`}
onChange={onChange}
type="password"
validations={{ required: true }}
value={get(modifiedData, `${inputsPrefix}password`, '')}
/>
<Input
error={formErrors[`${inputsPrefix}confirmPassword`]}
label="Auth.form.confirmPassword.label"
name={`${inputsPrefix}confirmPassword`}
onChange={onChange}
type="password"
validations={{ required: true }}
value={get(modifiedData, `${inputsPrefix}confirmPassword`, '')}
/>
<Flex alignItems="flex-start">
<Checkbox
name={`${inputsPrefix}news`}
onChange={onChange}
value={get(modifiedData, `${inputsPrefix}news`, false)}
/>
<Padded left size="sm" />
<CustomLabel
id="Auth.form.register.news.label"
values={{ terms, policy }}
onClick={() => {
onChange({
target: {
name: `${inputsPrefix}news`,
value: !get(modifiedData, `${inputsPrefix}news`, false),
},
});
}}
/>
</Flex>
<Padded top size="md">
<Button type="submit" color="primary" textTransform="uppercase">
{formatMessage({ id: 'Auth.form.button.register' })}
</Button>
</Padded>
</form>
</Box>
</Padded>
</Section>
{!noSignin && (
<AuthLink label="Auth.link.signin" to="/auth/login">
<Text fontSize="md">
{formatMessage({ id: 'Auth.link.signin.account' })}
<Text fontSize="md" color="#0097f7" as="span">
{formatMessage({ id: 'Auth.link.signin' })}
</Text>
</Text>
</AuthLink>
)}
</>
);
};
Register.defaultProps = {
fieldsToDisable: [],
inputsPrefix: '',
noSignin: false,
onSubmit: e => e.preventDefault(),
requestError: null,
};
Register.propTypes = {
fieldsToDisable: PropTypes.array,
formErrors: PropTypes.object.isRequired,
inputsPrefix: PropTypes.string,
modifiedData: PropTypes.object.isRequired,
noSignin: PropTypes.bool,
onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func,
requestError: PropTypes.object,
};
export default Register;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0049 ]-- |