@@ -89,6 +90,12 @@ class MainHomePagePortal extends React.Component {
onButtonClick: () => history.push('/check-ticket')
};
}
+
+ onCloseMessage() {
+ this.setState({
+ showMessage: false
+ });
+ }
}
export default connect((store) => {
diff --git a/client/src/app/main/main-home/main-home-page.js b/client/src/app/main/main-home/main-home-page.js
index 3dca00e1..95b3a08e 100644
--- a/client/src/app/main/main-home/main-home-page.js
+++ b/client/src/app/main/main-home/main-home-page.js
@@ -9,12 +9,19 @@ import MainHomePagePortal from 'app/main/main-home/main-home-page-portal';
import Message from 'core-components/message';
class MainHomePage extends React.Component {
-
+
+ state = {
+ showMessage: true
+ }
+
+ componentDidUpdate(prevProps) {
+ if (!prevProps.session && this.props.session) {
+ this.setState({showMessage : true});
+ }
+ }
+
render() {
- const {
- config,
- loginForm
- } = this.props;
+ const { config, loginForm } = this.props;
return (
{this.renderMessage()}
@@ -50,16 +57,26 @@ class MainHomePage extends React.Component {
renderSuccess() {
return (
-
- {i18n('VERIFY_SUCCESS_DESCRIPTION')}
+
+ {i18n('VERIFY_SUCCESS_DESCRIPTION')}
);
}
renderFailed() {
return (
-
- {i18n('VERIFY_FAILED_DESCRIPTION')}
+
+ {i18n('VERIFY_FAILED_DESCRIPTION')}
);
}
@@ -85,6 +102,12 @@ class MainHomePage extends React.Component {
return classNames(classes);
}
+
+ onCloseMessage() {
+ this.setState({
+ showMessage: false
+ });
+ }
}
export default connect((store) => {
diff --git a/client/src/app/main/main-recover-password/main-recover-password-page.js b/client/src/app/main/main-recover-password/main-recover-password-page.js
index a6807d52..4c3ca326 100644
--- a/client/src/app/main/main-recover-password/main-recover-password-page.js
+++ b/client/src/app/main/main-recover-password/main-recover-password-page.js
@@ -23,7 +23,8 @@ class MainRecoverPasswordPage extends React.Component {
this.state = {
recoverStatus: 'waiting',
- loading: false
+ loading: false,
+ showMessage: true
}
}
@@ -47,11 +48,27 @@ class MainRecoverPasswordPage extends React.Component {
}
renderRecoverStatus() {
- switch (this.state.recoverStatus) {
+ const { recoverStatus, showMessage } = this.state;
+
+ switch (recoverStatus) {
case 'valid':
- return {i18n('VALID_RECOVER')};
+ return (
+
+ {i18n('VALID_RECOVER')}
+
+ );
case 'invalid':
- return {i18n('INVALID_RECOVER')};
+ return (
+
+ {i18n('INVALID_RECOVER')}
+
+ );
case 'waiting':
return null;
}
@@ -78,6 +95,7 @@ class MainRecoverPasswordPage extends React.Component {
setTimeout(() => {history.push((response.data.staff*1) ? '/admin' : '/')}, 2000);
this.setState({
recoverStatus: 'valid',
+ showMessage: true,
loading: false
});
}
@@ -85,9 +103,16 @@ class MainRecoverPasswordPage extends React.Component {
onPasswordRecoverFail() {
this.setState({
recoverStatus: 'invalid',
+ showMessage: true,
loading: false
});
}
+
+ onCloseMessage(showMessage) {
+ this.setState({
+ [showMessage]: false
+ });
+ }
}
export default MainRecoverPasswordPage;
diff --git a/client/src/app/main/main-signup/main-signup-widget.js b/client/src/app/main/main-signup/main-signup-widget.js
index f6eaa7e4..3497df03 100644
--- a/client/src/app/main/main-signup/main-signup-widget.js
+++ b/client/src/app/main/main-signup/main-signup-widget.js
@@ -26,7 +26,9 @@ class MainSignUpWidget extends React.Component {
this.state = {
loading: false,
email: null,
- customFields: null
+ customFields: null,
+ showMessage: true,
+ message: null
};
}
@@ -89,11 +91,27 @@ class MainSignUpWidget extends React.Component {
}
renderMessage() {
- switch (this.state.message) {
+ const { message, showMessage } = this.state;
+
+ switch (message) {
case 'success':
- return {i18n('SIGNUP_SUCCESS')};
+ return (
+
+ {i18n('SIGNUP_SUCCESS')}
+
+ );
case 'fail':
- return {i18n('EMAIL_EXISTS')};
+ return (
+
+ {i18n('EMAIL_EXISTS')}
+
+ );
default:
return null;
}
@@ -153,7 +171,8 @@ class MainSignUpWidget extends React.Component {
onSignupSuccess() {
this.setState({
loading: false,
- message: 'success'
+ message: 'success',
+ showMessage: true
}, () => {
setTimeout(() => {history.push('/')}, 2000);
});
@@ -162,7 +181,14 @@ class MainSignUpWidget extends React.Component {
onSignupFail() {
this.setState({
loading: false,
- message: 'fail'
+ message: 'fail',
+ showMessage: true
+ });
+ }
+
+ onCloseMessage(showMessage) {
+ this.setState({
+ [showMessage]: false
});
}
}
diff --git a/client/src/core-components/message.js b/client/src/core-components/message.js
index cfb1c85f..c4dab3f0 100644
--- a/client/src/core-components/message.js
+++ b/client/src/core-components/message.js
@@ -10,30 +10,24 @@ class Message extends React.Component {
title: React.PropTypes.string,
children: React.PropTypes.node,
leftAligned: React.PropTypes.bool,
+ onCloseMessage: React.PropTypes.func,
type: React.PropTypes.oneOf(['success', 'error', 'info', 'warning'])
};
static defaultProps = {
type: 'info',
leftAligned: false,
- showCloseButton: true
- };
-
- state = {
+ showCloseButton: true,
showMessage: true
- }
-
- componentWillReceiveProps() {
- this.setState({
- showMessage: true
- })
- }
+ };
render() {
return (
-
- {this.renderMessage.bind(this)}
-
+ this.props.showMessage ?
+
+ {this.renderMessage.bind(this)}
+ :
+ null
);
}
@@ -49,7 +43,7 @@ class Message extends React.Component {
}
renderMessage(style) {
- return this.state.showMessage ? this.renderMessageContent(style) : null
+ return this.renderMessageContent(style);
}
renderMessageContent(style) {
@@ -100,11 +94,17 @@ class Message extends React.Component {
renderCloseButton() {
return (
- this.setState({showMessage: false})}>
+
);
}
+
+ onCloseMessage() {
+ const { onCloseMessage } = this.props
+
+ onCloseMessage && onCloseMessage();
+ }
}
export default Message;
diff --git a/server/controllers/system/edit-settings.php b/server/controllers/system/edit-settings.php
index 19ae9ea0..17d16fdd 100755
--- a/server/controllers/system/edit-settings.php
+++ b/server/controllers/system/edit-settings.php
@@ -102,7 +102,6 @@ class EditSettingsController extends Controller {
}
public function checkDefaultDepartmentValid() {
-
$departmentId = Controller::request('default-department-id');
if($departmentId){