ducky/web
ducky/web/src/pages/register.jsx
Remove .swp files, update package.json. Remove the .swp files and add .swp to the .hgignore file. Update package.json to pin webpack at 1.8.9 because 1.8.10 broke everything and decided that didn't deserve a major version bump. See https://github.com/webpack/webpack/issues/1016
| paddy@0 | 1 import app from 'ampersand-app' |
| paddy@0 | 2 import React from 'react/addons' |
| paddy@0 | 3 import localLinks from 'local-links' |
| paddy@0 | 4 import LaddaButton from 'react-ladda' |
| paddy@0 | 5 import LaddaCSS from '../../node_modules/ladda/dist/ladda.min.css' |
| paddy@0 | 6 import HeroUnit from '../components/hero' |
| paddy@0 | 7 import onboardingStyles from '../styles/onboarding.scss' |
| paddy@0 | 8 |
| paddy@0 | 9 export default React.createClass({ |
| paddy@0 | 10 displayName: 'RegisterPage', |
| paddy@0 | 11 mixins: [React.addons.LinkedStateMixin], |
| paddy@0 | 12 |
| paddy@0 | 13 getInitialState () { |
| paddy@0 | 14 return { |
| paddy@0 | 15 email: null, |
| paddy@0 | 16 emailConfirmation: null, |
| paddy@0 | 17 passphrase: null, |
| paddy@0 | 18 passphraseConfirmation: null, |
| paddy@0 | 19 active: false, |
| paddy@0 | 20 valid: false, |
| paddy@0 | 21 } |
| paddy@0 | 22 }, |
| paddy@0 | 23 |
| paddy@0 | 24 componentDidMount () { |
| paddy@0 | 25 app.profiles.on('request', (moc, xhr, options) => { |
| paddy@0 | 26 this.setState({active: true}) |
| paddy@0 | 27 }) |
| paddy@0 | 28 app.profiles.on('error', (moc, xhr, options) => { |
| paddy@0 | 29 this.setState({active: false}) |
| paddy@0 | 30 }) |
| paddy@0 | 31 app.profiles.on('sync', (moc, xhr, options) => { |
| paddy@0 | 32 app.me.login(this.state.email, this.state.passphrase) |
| paddy@0 | 33 }) |
| paddy@0 | 34 app.me.on('sync', (moc, xhr, options) => { |
| paddy@0 | 35 this.setState({active: false}) |
| paddy@0 | 36 console.log("logged in, continuing on to billing") |
| paddy@0 | 37 }) |
| paddy@0 | 38 }, |
| paddy@0 | 39 |
| paddy@0 | 40 register (e) { |
| paddy@0 | 41 e.preventDefault() |
| paddy@0 | 42 app.profiles.register(this.state.email, this.state.passphrase) |
| paddy@0 | 43 }, |
| paddy@0 | 44 |
| paddy@0 | 45 onBackClick (event) { |
| paddy@0 | 46 event.preventDefault() |
| paddy@0 | 47 window.history.back() |
| paddy@0 | 48 }, |
| paddy@0 | 49 |
| paddy@0 | 50 render () { |
| paddy@0 | 51 return ( |
| paddy@0 | 52 <div className='container'> |
| paddy@0 | 53 <HeroUnit title='Create an Account'>We’d like to get to know you better.</HeroUnit> |
| paddy@0 | 54 <article className='onboarding register'> |
| paddy@0 | 55 <form onSubmit={this.register}> |
| paddy@0 | 56 <div> |
| paddy@0 | 57 <label htmlFor='emailRegisterInput'>Email</label> |
| paddy@0 | 58 <input id='emailRegisterInput' type='email' placeholder='Ours is quack@useducky.com' valueLink={this.linkState('email')} disabled={this.state.active} /> |
| paddy@0 | 59 |
| paddy@0 | 60 <label htmlFor='emailVerificationInput'>Verify Email</label> |
| paddy@0 | 61 <input id='emailVerificationInput' type='email' placeholder='Typos are the absolute worst.' valueLink={this.linkState('emailConfirmation')} disabled={this.state.active} /> |
| paddy@0 | 62 |
| paddy@0 | 63 <label htmlFor='passwordRegisterInput'>Passphrase</label> |
| paddy@0 | 64 <input id='passwordRegisterInput' type='password' placeholder='We use a sentence. Try it!' valueLink={this.linkState('passphrase')} disabled={this.state.active} /> |
| paddy@0 | 65 |
| paddy@0 | 66 <label htmlFor='passwordVerificationInput'>Verify Passphrase</label> |
| paddy@0 | 67 <input id='passwordVerificationInput' type='password' placeholder='Just to make sure you know it.' valueLink={this.linkState('passphraseConfirmation')} disabled={this.state.active} /> |
| paddy@0 | 68 </div> |
| paddy@0 | 69 <div className='actionbuttons'> |
| paddy@0 | 70 <button onClick={this.onBackClick} disabled={this.state.active} type='button' className='ladda-button'>Back</button> |
| paddy@0 | 71 <LaddaButton style='expand-right' active={this.state.active}> |
| paddy@0 | 72 <button type='submit' className='primary' disabled={this.state.active || !this.state.valid}>Register</button> |
| paddy@0 | 73 </LaddaButton> |
| paddy@0 | 74 </div> |
| paddy@0 | 75 </form> |
| paddy@0 | 76 </article> |
| paddy@0 | 77 </div> |
| paddy@0 | 78 ) |
| paddy@0 | 79 } |
| paddy@0 | 80 }) |