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