Blame view
client/modules/recover-password.js
861 Bytes
c39994410
|
1 2 |
let _handleRecovery = ( template ) => { let email = template.find( '[name="emailAddress"]' ).value; |
0ccda7775
|
3 |
|
c39994410
|
4 5 6 7 8 9 10 |
Accounts.forgotPassword( { email: email }, ( error ) => { if ( error ) { Bert.alert( error.reason, 'warning' ); } else { Bert.alert( 'Check your inbox for a reset link!', 'success' ); } }); |
0ccda7775
|
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
}; let validation = ( template ) => { return { rules: { emailAddress: { required: true, email: true } }, messages: { emailAddress: { required: 'Need an email address here.', email: 'Is this email address legit?' } }, submitHandler() { _handleRecovery( template ); } }; }; |
c39994410
|
30 31 |
let _validate = ( form, template ) => { $( form ).validate( validation( template ) ); |
0ccda7775
|
32 |
}; |
c39994410
|
33 34 35 |
export function recoverPassword( options ) { _validate( options.form, options.template ); } |