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()}{i18n.Messages.IP_AUTHORIZATION_SUCCEEDED_SUGGESTION}
{this.renderLoginButton()}