diff --git a/src/App.js b/src/App.js index d20380e..2424990 100644 --- a/src/App.js +++ b/src/App.js @@ -13,6 +13,7 @@ import ColorSwitcher from './components/common/ColorSwitcher'; import NotificationContainer from './components/common/react-notifications/NotificationContainer'; import { isMultiColorActive, isDemo } from './constants/defaultValues'; import { getDirection } from './helpers/Utils'; +import SiteRules from './components/pages/SiteRules'; const ViewMain = React.lazy(() => import(/* webpackChunkName: "views" */ './views') @@ -81,6 +82,10 @@ class App extends Component { authUser={loginUser} component={ViewApp} /> + } + /> } diff --git a/src/components/pages/SiteRules.js b/src/components/pages/SiteRules.js new file mode 100644 index 0000000..3fad661 --- /dev/null +++ b/src/components/pages/SiteRules.js @@ -0,0 +1,49 @@ +import React, { Component } from "react"; +import { NavLink } from "react-router-dom"; +import { connect } from "react-redux"; + +class SiteRules extends Component { + + constructor(props) { + super(props); + this.state = { + }; + } + + render() { + + return ( + +
+
+
+

Правила сайта

+

+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit, + sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + Excepteur sint occaecat cupidatat non proident, + sunt in culpa qui officia deserunt mollit anim id est laborum." +

+ + Назад + +
+
+ +
+ + ); + } +} + +const mapStateToProps = ({ authUser }) => { + const { authLocation } = authUser; + return { authLocation }; + }; + +export default connect( + mapStateToProps, + )(SiteRules); + diff --git a/src/lang/locales/en_US.js b/src/lang/locales/en_US.js index 03d4594..ba3af04 100644 --- a/src/lang/locales/en_US.js +++ b/src/lang/locales/en_US.js @@ -19,6 +19,7 @@ module.exports = { "user.forgot-password": "Forgot Password", "user.email": "E-mail", "user.password": "Password", + "user.siteRules": "I agree", "user.forgot-password-question": "Forget password?", "user.fullname": "Full Name", "user.login-button": "LOGIN", diff --git a/src/redux/actions.js b/src/redux/actions.js index c8f85e5..7cf975a 100644 --- a/src/redux/actions.js +++ b/src/redux/actions.js @@ -2,6 +2,7 @@ export const CHANGE_LOCALE = "CHANGE_LOCALE"; /* AUTH */ +export const AUTH_LOCATION = "AUTH_LOCATION" export const LOGIN_USER = "LOGIN_USER"; export const LOGIN_USER_SUCCESS = "LOGIN_USER_SUCCESS"; export const LOGIN_USER_ERROR = "LOGIN_USER_ERROR"; diff --git a/src/redux/auth/actions.js b/src/redux/auth/actions.js index 5adba97..baf8917 100644 --- a/src/redux/auth/actions.js +++ b/src/redux/auth/actions.js @@ -11,9 +11,17 @@ import { FORGOT_PASSWORD_ERROR, RESET_PASSWORD, RESET_PASSWORD_SUCCESS, - RESET_PASSWORD_ERROR + RESET_PASSWORD_ERROR, + AUTH_LOCATION } from '../actions'; +export const authLocation = (location) => { + return { + type: AUTH_LOCATION, + payload: location + } +} + export const loginUser = (user, history) => ({ type: LOGIN_USER, payload: { user, history } diff --git a/src/redux/auth/reducer.js b/src/redux/auth/reducer.js index 36c8770..67d0c53 100644 --- a/src/redux/auth/reducer.js +++ b/src/redux/auth/reducer.js @@ -11,7 +11,8 @@ import { FORGOT_PASSWORD_ERROR, RESET_PASSWORD, RESET_PASSWORD_SUCCESS, - RESET_PASSWORD_ERROR + RESET_PASSWORD_ERROR, + AUTH_LOCATION } from '../actions'; const INIT_STATE = { @@ -19,12 +20,15 @@ const INIT_STATE = { forgotUserMail: '', newPassword: '', resetPasswordCode: '', + authLocation: '/', loading: false, error: '' }; export default (state = INIT_STATE, action) => { switch (action.type) { + case AUTH_LOCATION: + return { ...state, authLocation: action.payload }; case LOGIN_USER: return { ...state, loading: true, error: '' }; case LOGIN_USER_SUCCESS: diff --git a/src/views/user/login.js b/src/views/user/login.js index 4642621..8eb1c01 100644 --- a/src/views/user/login.js +++ b/src/views/user/login.js @@ -1,14 +1,14 @@ import React, { Component } from "react"; import { Row, Card, CardTitle, Label, FormGroup, Button } from "reactstrap"; -import { NavLink } from "react-router-dom"; +import { NavLink, withRouter } from "react-router-dom"; import { connect } from "react-redux"; - import { NotificationManager } from "../../components/common/react-notifications"; import { Formik, Form, Field } from "formik"; - -import { loginUser } from "../../redux/actions"; +import { loginUser, authLocation } from "../../redux/actions"; import { Colxx } from "../../components/common/CustomBootstrap"; import IntlMessages from "../../helpers/IntlMessages"; +import { compose } from "redux"; + class Login extends Component { constructor(props) { super(props); @@ -46,6 +46,10 @@ class Login extends Component { return error; } + componentDidMount(){ + this.props.authLocation(this.props.location.pathname) + } + componentDidUpdate() { if (this.props.error) { NotificationManager.warning( @@ -73,7 +77,7 @@ class Login extends Component { Please use your credentials to login.
If you are not a member, please{" "} - + register . @@ -124,9 +128,14 @@ class Login extends Component { )}
- - - +
+ + + + + Site rules + +