Display error correctly on ldap to email claim page (#3129)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
d2aacdbb07
Коммит
5ff85df9e9
22
webapp/actions/user_actions.jsx
Обычный файл
22
webapp/actions/user_actions.jsx
Обычный файл
@@ -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.
|
// See License.txt for license information.
|
||||||
|
|
||||||
import * as Utils from 'utils/utils.jsx';
|
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 React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
@@ -16,6 +17,7 @@ export default class LDAPToEmail extends React.Component {
|
|||||||
|
|
||||||
this.state = {};
|
this.state = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
submit(e) {
|
submit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var state = {};
|
var state = {};
|
||||||
@@ -44,20 +46,15 @@ export default class LDAPToEmail extends React.Component {
|
|||||||
state.error = null;
|
state.error = null;
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
|
|
||||||
Client.ldapToEmail(
|
switchFromLdapToEmail(
|
||||||
this.props.email,
|
this.props.email,
|
||||||
password,
|
password,
|
||||||
ldapPassword,
|
ldapPassword,
|
||||||
(data) => {
|
null,
|
||||||
if (data.follow_link) {
|
(err) => this.setState({error: err.message})
|
||||||
window.location.href = data.follow_link;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
(error) => {
|
|
||||||
this.setState({error});
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var error = null;
|
var error = null;
|
||||||
if (this.state.error) {
|
if (this.state.error) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user