summaryrefslogtreecommitdiffstats
path: root/webapp/components/user_settings
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-01-27 11:39:13 +0100
committerGeorge Goldberg <george@gberg.me>2017-01-27 10:39:13 +0000
commitd72547433af3ec5829ce0de4f4e1cfd440be7142 (patch)
tree6bd7664e9058468842c7b7bb7c7a76abf1b7c5e3 /webapp/components/user_settings
parent49c677f6b46409289210abc0e0bda63735be3e9f (diff)
downloadchat-d72547433af3ec5829ce0de4f4e1cfd440be7142.tar.gz
chat-d72547433af3ec5829ce0de4f4e1cfd440be7142.tar.bz2
chat-d72547433af3ec5829ce0de4f4e1cfd440be7142.zip
Move remaining client functions in components to actions (#5171)
Diffstat (limited to 'webapp/components/user_settings')
-rw-r--r--webapp/components/user_settings/user_settings_general.jsx6
-rw-r--r--webapp/components/user_settings/user_settings_security.jsx18
2 files changed, 10 insertions, 14 deletions
diff --git a/webapp/components/user_settings/user_settings_general.jsx b/webapp/components/user_settings/user_settings_general.jsx
index 06fe31a9e..d9551dccc 100644
--- a/webapp/components/user_settings/user_settings_general.jsx
+++ b/webapp/components/user_settings/user_settings_general.jsx
@@ -15,7 +15,7 @@ import * as AsyncClient from 'utils/async_client.jsx';
import * as Utils from 'utils/utils.jsx';
import {intlShape, injectIntl, defineMessages, FormattedMessage, FormattedHTMLMessage, FormattedDate} from 'react-intl';
-import {updateUser} from 'actions/user_actions.jsx';
+import {updateUser, uploadProfileImage} from 'actions/user_actions.jsx';
const holders = defineMessages({
usernameReserved: {
@@ -241,11 +241,11 @@ class UserSettingsGeneralTab extends React.Component {
this.setState({loadingPicture: true});
- Client.uploadProfileImage(picture,
+ uploadProfileImage(
+ picture,
() => {
this.updateSection('');
this.submitActive = false;
- AsyncClient.getMe();
},
(err) => {
var state = this.setupInitialState(this.props);
diff --git a/webapp/components/user_settings/user_settings_security.jsx b/webapp/components/user_settings/user_settings_security.jsx
index e936f5b96..210e455b7 100644
--- a/webapp/components/user_settings/user_settings_security.jsx
+++ b/webapp/components/user_settings/user_settings_security.jsx
@@ -9,12 +9,11 @@ import ToggleModalButton from '../toggle_modal_button.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
-import Client from 'client/web_client.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
-import {updatePassword} from 'actions/user_actions.jsx';
+import {updatePassword, getAuthorizedApps, deactivateMfa, deauthorizeOAuthApp} from 'actions/user_actions.jsx';
import $ from 'jquery';
import React from 'react';
@@ -29,7 +28,7 @@ export default class SecurityTab extends React.Component {
this.submitPassword = this.submitPassword.bind(this);
this.setupMfa = this.setupMfa.bind(this);
- this.deactivateMfa = this.deactivateMfa.bind(this);
+ this.removeMfa = this.removeMfa.bind(this);
this.updateCurrentPassword = this.updateCurrentPassword.bind(this);
this.updateNewPassword = this.updateNewPassword.bind(this);
this.updateConfirmPassword = this.updateConfirmPassword.bind(this);
@@ -55,7 +54,7 @@ export default class SecurityTab extends React.Component {
componentDidMount() {
if (global.mm_config.EnableOAuthServiceProvider === 'true') {
- Client.getAuthorizedApps(
+ getAuthorizedApps(
(authorizedApps) => {
this.setState({authorizedApps, serverError: null}); //eslint-disable-line react/no-did-mount-set-state
},
@@ -120,10 +119,8 @@ export default class SecurityTab extends React.Component {
browserHistory.push('/mfa/setup');
}
- deactivateMfa() {
- Client.updateMfa(
- '',
- false,
+ removeMfa() {
+ deactivateMfa(
() => {
if (global.window.mm_license.MFA === 'true' &&
global.window.mm_config.EnableMultifactorAuthentication === 'true' &&
@@ -133,7 +130,6 @@ export default class SecurityTab extends React.Component {
}
this.props.updateSection('');
- AsyncClient.getMe();
this.setState(this.getDefaultState());
},
(err) => {
@@ -163,7 +159,7 @@ export default class SecurityTab extends React.Component {
deauthorizeApp(e) {
e.preventDefault();
const appId = e.currentTarget.getAttribute('data-app');
- Client.deauthorizeOAuthApp(
+ deauthorizeOAuthApp(
appId,
() => {
const authorizedApps = this.state.authorizedApps.filter((app) => {
@@ -223,7 +219,7 @@ export default class SecurityTab extends React.Component {
<a
className='btn btn-primary'
href='#'
- onClick={this.deactivateMfa}
+ onClick={this.removeMfa}
>
{mfaButtonText}
</a>