Vulcan/packages/vulcan-base-components/lib/users/UsersResetPassword.jsx

45 lines
1.1 KiB
React
Raw Normal View History

2017-03-24 10:41:11 +09:00
import { Components, registerComponent, withCurrentUser } from 'meteor/vulcan:core';
2017-05-19 14:42:43 -06:00
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router';
2017-03-24 10:41:11 +09:00
import { intlShape } from 'react-intl';
2016-10-28 21:22:17 -07:00
2017-05-19 14:42:43 -06:00
class UsersResetPassword extends PureComponent {
2016-10-28 21:22:17 -07:00
componentDidMount() {
const token = this.props.params.token;
Accounts._loginButtonsSession.set('resetPasswordToken', token);
}
render() {
2016-11-15 18:33:16 +01:00
if (!this.props.currentUser) {
return (
2017-03-24 10:41:11 +09:00
<Components.AccountsLoginForm
formState={ Symbol('PASSWORD_CHANGE') }
/>
);
}
2016-10-28 21:22:17 -07:00
return (
<div className='password-reset-form'>
2017-03-24 10:41:11 +09:00
<div>{this.context.intl.formatMessage({id: 'accounts.info_password_changed'})}!</div>
<Link to="/">
Return Home
</Link>
</div>
2016-10-28 21:22:17 -07:00
);
}
}
2017-03-24 10:41:11 +09:00
UsersResetPassword.contextTypes = {
intl: intlShape
}
2016-11-15 18:33:16 +01:00
UsersResetPassword.propsTypes = {
2017-05-19 14:42:43 -06:00
currentUser: PropTypes.object,
params: PropTypes.object,
};
2016-11-15 18:33:16 +01:00
UsersResetPassword.displayName = 'UsersResetPassword';
registerComponent('UsersResetPassword', UsersResetPassword, withCurrentUser);