import React from 'react'; import PureRenderMixin from 'react-addons-pure-render-mixin'; import Flux from '../lib/flux'; import {Link} from 'react-router'; import BaseAuthForm from './BaseAuthForm'; import Spinner from './common/Spinner'; import AuthenticationActionCreators from '../actions/AuthenticationActionCreators'; import AuthenticationStore from '../stores/AuthenticationStore'; import {Routes} from '../Constants'; import i18n from '../i18n'; import platform from 'platform'; const AuthorizeIPAddress = React.createClass({ mixins: [PureRenderMixin, Flux.StoreListenerMixin(AuthenticationStore)], componentDidMount() { process.nextTick(() => { AuthenticationActionCreators.authorizeIPAddress(this.props.location.query['token']); }); }, getStateFromStores() { return { verifyFailed: AuthenticationStore.didVerifyFail(), verifySucceeded: AuthenticationStore.didVerifySucceed(), }; }, renderLoginButton() { if (platform.os.family === 'Android' || platform.os.family === 'iOS') { return null; } return {i18n.Messages.LOGIN}; }, render() { let content; if (this.state.verifyFailed) { content = (

{i18n.Messages.AUTHORIZATION_EXPIRED}

{i18n.Messages.AUTHORIZATION_EXPIRED_SUGGESTION}

{this.renderLoginButton()}
); } else if (this.state.verifySucceeded) { content = (

{i18n.Messages.IP_AUTHORIZATION_SUCCEEDED}

{i18n.Messages.IP_AUTHORIZATION_SUCCEEDED_SUGGESTION}

{this.renderLoginButton()}
); } else { content = (

{i18n.Messages.AUTHORIZING}

); } return (
{content}
); }, }); export default AuthorizeIPAddress; // WEBPACK FOOTER // // ./discord_app/components/AuthorizeIPAddress.js