Add Enroll Account component and route

This commit is contained in:
Justin Reynolds 2018-01-25 12:56:40 -06:00
parent 020d970beb
commit 0e5feab3fa
4 changed files with 45 additions and 0 deletions

View file

@ -9,3 +9,4 @@ import './ui/components/LoginForm.jsx';
import './ui/components/PasswordOrService.jsx';
import './ui/components/SocialButtons.jsx';
import './ui/components/ResetPassword.jsx';
import './ui/components/EnrollAccount.jsx';

View file

@ -1,3 +1,4 @@
import { addRoute } from 'meteor/vulcan:core';
addRoute({name: 'resetPassword', path: '/reset-password/:token', componentName: 'AccountsResetPassword'});
addRoute({name: 'enrollAccount', path: '/enroll-account/:token', componentName: 'AccountsEnrollAccount'});

View file

@ -0,0 +1,42 @@
import { Components, registerComponent, withCurrentUser } from 'meteor/vulcan:core';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router';
import { intlShape } from 'meteor/vulcan:i18n';
import { STATES } from '../../helpers.js';
class AccountsEnrollAccount extends PureComponent {
componentDidMount() {
const token = this.props.params.token;
Accounts._loginButtonsSession.set('enrollAccountToken', token);
}
render() {
if (!this.props.currentUser) {
return (
<Components.AccountsLoginForm
formState={ STATES.ENROLL_ACCOUNT }
/>
);
} else {
return (
<div className='password-reset-form'>
<div>{this.context.intl.formatMessage({id: 'accounts.info_password_changed'})}!</div>
</div>
);
}
}
}
AccountsEnrollAccount.contextTypes = {
intl: intlShape
}
AccountsEnrollAccount.propsTypes = {
currentUser: PropTypes.object,
params: PropTypes.object,
};
AccountsEnrollAccount.displayName = 'AccountsEnrollAccount';
registerComponent('AccountsEnrollAccount', AccountsEnrollAccount, withCurrentUser);

View file

@ -1 +1,2 @@
Accounts.urls.resetPassword = (token) => Meteor.absoluteUrl(`reset-password/${token}`);
Accounts.urls.enrollAccount = (token) => Meteor.absoluteUrl(`enroll-account/${token}`);