Blame view
client/controllers/public/recover-password.js
1.28 KB
3b214be5e
|
1 2 3 4 5 6 7 8 |
/* * Controller: Recover Password * Template: /client/views/public/recover-password.html */ /* * Created */ |
76b8987a6
|
9 |
Template.recoverPassword.onCreated(function(){ |
3b214be5e
|
10 |
// Code to run when template is created goes here. |
76b8987a6
|
11 |
}); |
3b214be5e
|
12 13 14 15 |
/* * Rendered */ |
76b8987a6
|
16 |
Template.recoverPassword.onRendered(function(){ |
3b214be5e
|
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
$('#application-recover-password').validate({ rules: { emailAddress: { required: true, email: true } }, messages: { emailAddress: { required: "Please enter your email address to recover your password.", email: "Please enter a valid email address." } }, submitHandler: function(){ // Grab the user's email address. var email = $('[name="emailAddress"]').val(); // Call the send reset password email method. Accounts.forgotPassword({email: email}, function(error){ if(error){ |
c8b07469e
|
37 38 39 |
Bert.alert(error.reason, 'danger'); } else { Bert.alert('Check your inbox for a reset link!', 'success'); |
3b214be5e
|
40 41 42 43 |
} }); } }); |
76b8987a6
|
44 |
}); |
3b214be5e
|
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
/* * Helpers */ Template.recoverPassword.helpers({ example: function(){ // Code to run for helper function. } }); /* * Events */ Template.recoverPassword.events({ 'submit form': function(e){ // Prevent form from submitting. e.preventDefault(); } }); |