Blame view
imports/client/views/verify/EmailPane.js
2.99 KB
878ca8a15
|
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 102 103 104 105 106 107 108 109 110 |
import React from 'react'; import { Link } from 'react-router'; import { If, Case } from '/imports/client/components/Logic'; import { Bert } from 'meteor/themeteorchef:bert'; 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-box"> <div className = "wizardPane-section"> <div className="icon-circle icon-lg"> <i className="icon icon-simple icon-envelope"></i> </div> <div className = "wizardPane-title"> Set your email address </div> <div className = "col-xs-8 horizontalform verifyEmail wizardPane-text"> <div className="form-row"> <Col sm={4}> Enter email </Col> <Col sm={8}> <input type = "text" value = {this.state.email} onChange = {(evt) => this.onUpdate('email', evt.currentTarget.value)} placeholder = "Email" /> </Col> </div> </div> </div> <div className = "wizardPane-section wizardPane-footer"> <div className = "wizardPane-button btn btn-blue" onClick = {() => this.onSetEmail()} > Send verification email </div> </div> </div> ); }; renderMessage() { const {user} = this.props; return ( <div className = "wizardPane-box"> <div className = "wizardPane-section"> <div className = "wizardPane-title"> <i className="icon-envelope icon"></i> <h3>Verify your email</h3> </div> <div className = "wizardPane-text"> Check your email – we sent a verification link to<br/> {user.emails[0].address} </div> </div> <div className = "wizardPane-section 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(); }; }; |