Vulcan/packages/vulcan-accounts/imports/ui/components/ResetPassword.jsx

42 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';
2017-06-01 11:42:30 +09:00
import { intlShape } from 'meteor/vulcan:i18n';
import { STATES } from '../../helpers.js';
2016-10-28 21:22:17 -07:00
class AccountsResetPassword 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={ STATES.PASSWORD_CHANGE }
/>
);
} else {
return (
<div className='password-reset-form'>
<div>{this.context.intl.formatMessage({id: 'accounts.info_password_changed'})}!</div>
</div>
);
}
2016-10-28 21:22:17 -07:00
}
}
AccountsResetPassword.contextTypes = {
2017-03-24 10:41:11 +09:00
intl: intlShape
}
AccountsResetPassword.propsTypes = {
2017-05-19 14:42:43 -06:00
currentUser: PropTypes.object,
params: PropTypes.object,
};
2016-11-15 18:33:16 +01:00
AccountsResetPassword.displayName = 'AccountsResetPassword';
registerComponent('AccountsResetPassword', AccountsResetPassword, withCurrentUser);