EmailPane.js
2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import React from 'react';
import { Link } from 'react-router';
import { If, Case } from '/imports/client/components/Logic';
import { Bert } from 'meteor/themeteorchef:bert';
import './emailpane.css';
import { Row, Col, Alert,ControlLabel,
FormGroup, FormControl, Button } from 'react-bootstrap';
export class EmailPane extends React.Component {
constructor(props) {
super(props);
this.state = {
email: props.user.emails[0].address,
form: false,
};
};
onUpdate(key, val) {
this.setState({[key]: val});
};
onSetEmail() {
startEmailVerification.call({email: this.state.email}, (err, res)=>{
Bert.alert('New verification email sent!', 'success');
});
this.setState({form: false});
};
onShowForm() {
this.setState({form: true});
};
renderForm() {
const {user} = this.props;
return (
<div className = "wizardPane-box1">
<div>
<i className="fa fa-envelope-o fa-3x"></i>
</div>
<div>
<Row>
<Col md={12}>
<FormGroup>
<ControlLabel className='subheading'>Email</ControlLabel>
<FormControl
type="text"
value = {this.state.email}
onChange = {(evt) => this.onUpdate('email', evt.currentTarget.value)}
placeholder="Organisation Name"
/>
</FormGroup>
</Col>
</Row>
</div>
<div className = "wizardPane-sectionD wizardPane-footer">
<Button type="submit" onClick = {() => this.onSetEmail()} className='blue'>Verify Now</Button>
{/* <Button type="submit" onClick = {() => this.onSetEmail()} className='blue'>Sign Up</Button> */}
</div>
</div>
);
};
renderMessage() {
const {user} = this.props;
return (
<div className = "wizardPane-box verifyEmailBox">
<div className = "wizardPane-section1">
<div className = "wizardPane-title">
{/* <i className="icon-envelope icon"></i> */}
<h3>Hi {user.getFullName()}, your email needs verification</h3>
<span>Please check your email – we sent a verification link to
<span className = "EmailVerify">
{user.emails[0].address}</span></span>
</div>
</div>
<div className = "wizardPane-sectionD wizardPane-footer">
<div className="btn"
className = "wizardPane-link"
onClick = {() => this.onShowForm()}
>
Email did not arrive or want to use a different email?
</div>
</div>
</div>
);
};
render() {
return this.state.form ? this.renderForm() : this.renderMessage();
};
};