Blame view
client/modules/signup.js
1.03 KB
db5aba845
|
1 2 3 |
let template; let _handleSignup = () => { |
c39994410
|
4 5 6 7 |
let user = { email: template.find( '[name="emailAddress"]' ).value, password: template.find( '[name="password"]' ).value }; |
0ccda7775
|
8 |
|
c39994410
|
9 10 11 12 13 14 15 |
Accounts.createUser( user, ( error ) => { if ( error ) { Bert.alert( error.reason, 'danger' ); } else { Bert.alert( 'Welcome!', 'success' ); } }); |
0ccda7775
|
16 |
}; |
db5aba845
|
17 |
let validation = () => { |
0ccda7775
|
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
return { rules: { emailAddress: { required: true, email: true }, password: { required: true, minlength: 6 } }, messages: { emailAddress: { required: 'Need an email address here.', email: 'Is this email address legit?' }, password: { required: 'Need a password here.', minlength: 'Use at least six characters, please.' } }, |
db5aba845
|
39 |
submitHandler() { _handleSignup(); } |
0ccda7775
|
40 41 |
}; }; |
db5aba845
|
42 43 |
let _validate = ( form ) => { $( form ).validate( validation() ); |
0ccda7775
|
44 |
}; |
db5aba845
|
45 46 47 |
export default function( options ) { template = options.template; _validate( options.form ); |
c39994410
|
48 |
} |