- Add support for email verification.
- Clean up formatting of accounts email templates.
This commit is contained in:
parent
54d7acb2a6
commit
75b470907b
6 changed files with 112 additions and 10 deletions
42
imports/ui/pages/VerifyEmail/VerifyEmail.js
Normal file
42
imports/ui/pages/VerifyEmail/VerifyEmail.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Alert } from 'react-bootstrap';
|
||||
import { Accounts } from 'meteor/accounts-base';
|
||||
import { Bert } from 'meteor/themeteorchef:bert';
|
||||
|
||||
class VerifyEmail extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { error: null };
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { match, history } = this.props;
|
||||
Accounts.verifyEmail(match.params.token, (error) => {
|
||||
if (error) {
|
||||
Bert.alert(error.reason, 'danger');
|
||||
this.setState({ error: `${error.reason}. Please try again.` });
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
Bert.alert('All set, thanks!', 'success');
|
||||
history.push('/documents');
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (<div className="VerifyEmail">
|
||||
<Alert bsStyle={!this.state.error ? 'info' : 'danger'}>
|
||||
{!this.state.error ? 'Verifying...' : this.state.error}
|
||||
</Alert>
|
||||
</div>);
|
||||
}
|
||||
}
|
||||
|
||||
VerifyEmail.propTypes = {
|
||||
match: PropTypes.object.isRequired,
|
||||
history: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
export default VerifyEmail;
|
||||
Loading…
Add table
Add a link
Reference in a new issue