mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
Add Enroll Account component and route
This commit is contained in:
parent
020d970beb
commit
0e5feab3fa
4 changed files with 45 additions and 0 deletions
|
@ -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';
|
||||
|
|
|
@ -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'});
|
||||
|
|
|
@ -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);
|
|
@ -1 +1,2 @@
|
|||
Accounts.urls.resetPassword = (token) => Meteor.absoluteUrl(`reset-password/${token}`);
|
||||
Accounts.urls.enrollAccount = (token) => Meteor.absoluteUrl(`enroll-account/${token}`);
|
||||
|
|
Loading…
Add table
Reference in a new issue