|
@@ -2,16 +2,14 @@ import React, { useState } from 'react'
|
|
|
import authBg from '../images/authBg.png'
|
|
|
import { connect } from 'react-redux'
|
|
|
import { NavLink, Route } from 'react-router-dom'
|
|
|
-import { actionFullLogin } from '../actions'
|
|
|
+import { actionFullLogin, actionFullRegister } from '../actions'
|
|
|
|
|
|
-
|
|
|
-import { Form, Input, Button, Row, Col, Card, Divider } from 'antd';
|
|
|
+import { Form, Input, Button, Row, Col, Card, Divider, Checkbox } from 'antd';
|
|
|
import { UserOutlined, LockOutlined } from '@ant-design/icons';
|
|
|
|
|
|
const FormInput = ({ buttonTitle, onSignIn }) => {
|
|
|
- const onFinish = ({ login, password }) => {
|
|
|
- console.log('Received values of form: ', );
|
|
|
- onSignIn(login, password)
|
|
|
+ const onFinish = ({ login, password, remember }) => {
|
|
|
+ onSignIn(login, password, remember)
|
|
|
};
|
|
|
return (
|
|
|
<Form
|
|
@@ -52,6 +50,16 @@ const FormInput = ({ buttonTitle, onSignIn }) => {
|
|
|
placeholder="Password"
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ name="remember"
|
|
|
+ valuePropName="checked"
|
|
|
+ wrapperCol={{
|
|
|
+ offset: 8,
|
|
|
+ span: 16,
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Checkbox>Remember me</Checkbox>
|
|
|
+ </Form.Item>
|
|
|
<Form.Item >
|
|
|
<Button type="primary" className="login-form-button" htmlType="submit">
|
|
|
{buttonTitle}
|
|
@@ -60,12 +68,10 @@ const FormInput = ({ buttonTitle, onSignIn }) => {
|
|
|
</Form>
|
|
|
)
|
|
|
}
|
|
|
-const actionRegister = (login, pas) => alert('hi'+ login + ' ' + pas)
|
|
|
-const CLoginForm = connect(null, { onSignIn: actionFullLogin })(FormInput)
|
|
|
-const CRegisterForm = connect(null, { onSignIn: actionRegister })(FormInput)
|
|
|
+const CLoginForm = connect(null, { onSignIn: actionFullLogin})(FormInput)
|
|
|
+const CRegisterForm = connect(null, { onSignIn: actionFullRegister})(FormInput)
|
|
|
|
|
|
export const Authorization = ({ match: { params: { _id } } }) => {
|
|
|
- console.log(_id);
|
|
|
return (
|
|
|
<div className='Authorization' style={{ backgroundImage: `url(${authBg})` }}>
|
|
|
<Row justify="end" align="middle" className='Authorization__form'>
|
|
@@ -76,7 +82,6 @@ export const Authorization = ({ match: { params: { _id } } }) => {
|
|
|
<NavLink activeClassName='active' to={'/auth/registration'}>Registration</NavLink>
|
|
|
<Divider>{_id === 'login' ? 'Log in' : 'Registration'}</Divider >
|
|
|
{_id === 'login' ? <CLoginForm buttonTitle={'Sign In'} /> : <CRegisterForm buttonTitle={'Sign up'} />}
|
|
|
-
|
|
|
</Card>
|
|
|
</Col>
|
|
|
</Row >
|