|
@@ -6,7 +6,7 @@ import loggerFactory from '@alias/logger';
|
|
|
import Modal from 'react-bootstrap/es/Modal';
|
|
import Modal from 'react-bootstrap/es/Modal';
|
|
|
|
|
|
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
|
-import { toastError } from '../../../util/apiNotification';
|
|
|
|
|
|
|
+import { toastSuccess, toastError } from '../../../util/apiNotification';
|
|
|
|
|
|
|
|
import AppContainer from '../../../services/AppContainer';
|
|
import AppContainer from '../../../services/AppContainer';
|
|
|
import AdminLdapSecurityContainer from '../../../services/AdminLdapSecurityContainer';
|
|
import AdminLdapSecurityContainer from '../../../services/AdminLdapSecurityContainer';
|
|
@@ -22,6 +22,7 @@ class LdapAuthTestModal extends React.Component {
|
|
|
username: '',
|
|
username: '',
|
|
|
password: '',
|
|
password: '',
|
|
|
logs: '',
|
|
logs: '',
|
|
|
|
|
+ errorMessage: null,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
this.onChangeUsername = this.onChangeUsername.bind(this);
|
|
this.onChangeUsername = this.onChangeUsername.bind(this);
|
|
@@ -68,8 +69,20 @@ class LdapAuthTestModal extends React.Component {
|
|
|
|
|
|
|
|
// add logs
|
|
// add logs
|
|
|
if (response.err) {
|
|
if (response.err) {
|
|
|
|
|
+ toastError(response.err);
|
|
|
this.addLogs(response.err);
|
|
this.addLogs(response.err);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (response.status === 'warning') {
|
|
|
|
|
+ this.addLogs(response.message);
|
|
|
|
|
+ this.setState({ errorMessage: response.message });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (response.status === 'success') {
|
|
|
|
|
+ toastSuccess(response.message);
|
|
|
|
|
+ this.setState({ errorMessage: null });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (response.ldapConfiguration) {
|
|
if (response.ldapConfiguration) {
|
|
|
const prettified = JSON.stringify(response.ldapConfiguration.server, undefined, 4);
|
|
const prettified = JSON.stringify(response.ldapConfiguration.server, undefined, 4);
|
|
|
this.addLogs(`LDAP Configuration : ${prettified}`);
|
|
this.addLogs(`LDAP Configuration : ${prettified}`);
|
|
@@ -98,6 +111,7 @@ class LdapAuthTestModal extends React.Component {
|
|
|
</Modal.Title>
|
|
</Modal.Title>
|
|
|
</Modal.Header>
|
|
</Modal.Header>
|
|
|
<Modal.Body>
|
|
<Modal.Body>
|
|
|
|
|
+ {this.state.errorMessage != null && <div className="alert alert-warning">{this.state.errorMessage}</div>}
|
|
|
<div className="row p-3">
|
|
<div className="row p-3">
|
|
|
<label htmlFor="username" className="col-xs-3 text-right">{t('username')}</label>
|
|
<label htmlFor="username" className="col-xs-3 text-right">{t('username')}</label>
|
|
|
<div className="col-xs-6">
|
|
<div className="col-xs-6">
|