Blame view

client/controllers/public/recover-password.coffee 1016 Bytes
d1f4dbea8   Ryan Glover   Additional README...
1
  ###
5f6f6fbb0   Ryan Glover   Clean up spacing....
2
3
    Controller: Recover Password
    Template: /client/views/public/recover-password.html
d1f4dbea8   Ryan Glover   Additional README...
4
5
6
7
  ###
  
  # Created
  Template.recoverPassword.created = ->
5f6f6fbb0   Ryan Glover   Clean up spacing....
8
    # Code to run when template is created goes here.
d1f4dbea8   Ryan Glover   Additional README...
9
10
11
  
  # Rendered
  Template.recoverPassword.rendered = ->
aa2061a70   Ryan Glover   Add jQuery Valida...
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    $('#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: ->
        # Grab the user's details.
        email = $('[name="emailAddress"]').val()
  
        # Call the send reset password email method.
        Accounts.forgotPassword(email: email, (error)->
          alert error.reason if error
        )
    )
d1f4dbea8   Ryan Glover   Additional README...
30
31
32
  
  # Helpers
  Template.recoverPassword.helpers(
5f6f6fbb0   Ryan Glover   Clean up spacing....
33
34
    example: ->
      # Code to run for helper function.
d1f4dbea8   Ryan Glover   Additional README...
35
36
37
38
  )
  
  # Events
  Template.recoverPassword.events(
aa2061a70   Ryan Glover   Add jQuery Valida...
39
    'submit form': (e) ->
2cfb4bd0e   Ryan Glover   Add password reco...
40
41
      # Prevent form from submitting.
      e.preventDefault()
d1f4dbea8   Ryan Glover   Additional README...
42
  )