mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Display error correctly on ldap to email claim page (#3129)
This commit is contained in:
committed by
Corey Hulen
parent
d2aacdbb07
commit
5ff85df9e9
22
webapp/actions/user_actions.jsx
Normal file
22
webapp/actions/user_actions.jsx
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import Client from 'utils/web_client.jsx';
|
||||
|
||||
export function switchFromLdapToEmail(email, password, ldapPassword, onSuccess, onError) {
|
||||
Client.ldapToEmail(
|
||||
email,
|
||||
password,
|
||||
ldapPassword,
|
||||
(data) => {
|
||||
if (data.follow_link) {
|
||||
window.location.href = data.follow_link;
|
||||
}
|
||||
|
||||
if (onSuccess) {
|
||||
onSuccess(data);
|
||||
}
|
||||
},
|
||||
onError
|
||||
);
|
||||
}
|
||||
@@ -2,7 +2,8 @@
|
||||
// See License.txt for license information.
|
||||
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
import Client from 'utils/web_client.jsx';
|
||||
|
||||
import {switchFromLdapToEmail} from 'actions/user_actions.jsx';
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
@@ -16,6 +17,7 @@ export default class LDAPToEmail extends React.Component {
|
||||
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
submit(e) {
|
||||
e.preventDefault();
|
||||
var state = {};
|
||||
@@ -44,20 +46,15 @@ export default class LDAPToEmail extends React.Component {
|
||||
state.error = null;
|
||||
this.setState(state);
|
||||
|
||||
Client.ldapToEmail(
|
||||
switchFromLdapToEmail(
|
||||
this.props.email,
|
||||
password,
|
||||
ldapPassword,
|
||||
(data) => {
|
||||
if (data.follow_link) {
|
||||
window.location.href = data.follow_link;
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
this.setState({error});
|
||||
}
|
||||
null,
|
||||
(err) => this.setState({error: err.message})
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
var error = null;
|
||||
if (this.state.error) {
|
||||
|
||||
Reference in New Issue
Block a user