From 842afe49eb4edd6d2ddb7ec761696bb39249dbc5 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 25 Sep 2016 01:30:38 -0300 Subject: [PATCH] Ivan - STAFF LOGIN - Fix issues and improve frontend login [skip ci] --- client/src/app/App.js | 2 +- client/src/app/admin/admin-login-page.js | 21 +++++++++++++++++-- client/src/app/admin/admin-login-page.scss | 8 +++---- .../admin/panel/admin-panel-staff-widget.js | 7 ++++++- .../dashboard-edit-profile-page.js | 1 - client/src/data/languages/en.js | 1 + 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/client/src/app/App.js b/client/src/app/App.js index 90197430..52d55cb5 100644 --- a/client/src/app/App.js +++ b/client/src/app/App.js @@ -45,7 +45,7 @@ class App extends React.Component { languageChanged: props.config.language !== this.props.config.language, loggedIn: !_.includes(props.location.pathname, '/dashboard') && props.session.logged, loggedOut: _.includes(props.location.pathname, '/dashboard') && !props.session.logged, - loggedInStaff: !_.includes(props.location.pathname, '/admin/panel') && props.session.staff, + loggedInStaff: !_.includes(props.location.pathname, '/admin/panel') && props.session.logged && props.session.staff, loggedOutStaff: _.includes(props.location.pathname, '/admin/panel') && !props.session.logged }; diff --git a/client/src/app/admin/admin-login-page.js b/client/src/app/admin/admin-login-page.js index 12d74dc5..9d7f2770 100644 --- a/client/src/app/admin/admin-login-page.js +++ b/client/src/app/admin/admin-login-page.js @@ -8,12 +8,14 @@ import SessionActions from 'actions/session-actions'; import Form from 'core-components/form'; import FormField from 'core-components/form-field'; import SubmitButton from 'core-components/submit-button'; +import Message from 'core-components/message'; +import Widget from 'core-components/widget'; class AdminLoginPage extends React.Component { render() { return (
-
+
OpenSupports Admin Panel
@@ -22,11 +24,26 @@ class AdminLoginPage extends React.Component { {i18n('LOG_IN')}
-
+ {this.renderMessage()} +
); } + renderMessage() { + let message = null; + + if(this.props.session.failed) { + message = ( + + {i18n('EMAIL_OR_PASSWORD')} + + ); + } + + return message; + } + onSubmit(formState) { this.props.dispatch(SessionActions.login(_.extend({}, formState, { staff: true diff --git a/client/src/app/admin/admin-login-page.scss b/client/src/app/admin/admin-login-page.scss index 60a5a738..57b07631 100644 --- a/client/src/app/admin/admin-login-page.scss +++ b/client/src/app/admin/admin-login-page.scss @@ -5,11 +5,7 @@ &__content { margin: 0 auto; - display: inline-block; - background-color: white; padding: 40px; - border-radius: 4px; - text-align: center; } &__image { @@ -21,4 +17,8 @@ margin: 0 auto; display: inline-block; } + + &__error { + margin-top: 30px; + } } \ No newline at end of file diff --git a/client/src/app/admin/panel/admin-panel-staff-widget.js b/client/src/app/admin/panel/admin-panel-staff-widget.js index c213a752..913f151d 100644 --- a/client/src/app/admin/panel/admin-panel-staff-widget.js +++ b/client/src/app/admin/panel/admin-panel-staff-widget.js @@ -4,6 +4,7 @@ import {connect} from 'react-redux'; import i18n from 'lib-app/i18n'; import Button from 'core-components/button'; +import SessionActions from 'actions/session-actions'; class AdminPanelStaffWidget extends React.Component { @@ -17,7 +18,7 @@ class AdminPanelStaffWidget extends React.Component { {i18n('MY_ACCOUNT')} | - @@ -38,6 +39,10 @@ class AdminPanelStaffWidget extends React.Component { return classNames(classes); } + + closeSession() { + this.props.dispatch(SessionActions.logout()); + } } export default connect((store) => { diff --git a/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.js b/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.js index 4e32405f..fed82146 100644 --- a/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.js +++ b/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.js @@ -20,7 +20,6 @@ class DashboardEditProfilePage extends React.Component { messagePass:'' }; - render() { return (
diff --git a/client/src/data/languages/en.js b/client/src/data/languages/en.js index c41e460c..8335a733 100644 --- a/client/src/data/languages/en.js +++ b/client/src/data/languages/en.js @@ -57,6 +57,7 @@ export default { 'FILTERS_CUSTOM_FIELDS': 'Filters and Custom Fields', //ERRORS + 'EMAIL_OR_PASSWORD': 'Email or password invalid', 'EMAIL_NOT_EXIST': 'Email does not exist', 'ERROR_EMPTY': 'Invalid value', 'ERROR_PASSWORD': 'Invalid password',