Blame view
client/modules/recover-password.js
907 Bytes
0ccda7775
|
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 |
let recoverPassword = ( options ) => { _validate( options.form, options.template ); }; let _validate = ( form, template ) => { $( form ).validate( validation( template ) ); }; 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 ); } }; }; let _handleRecovery = ( template ) => { let email = template.find( '[name="emailAddress"]' ).value; Accounts.forgotPassword( { email: email }, ( error ) => { if ( error ) { Bert.alert( error.reason, 'warning' ); } else { Bert.alert( 'Check your inbox for a reset link!', 'success' ); } }); }; Modules.client.recoverPassword = recoverPassword; |