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