Blame view

client/controllers/public/signup.coffee 1014 Bytes
d1f4dbea8   Ryan Glover   Additional README...
1
  ###
5f6f6fbb0   Ryan Glover   Clean up spacing....
2
3
    Controller: Signup
    Template: /client/views/public/signup.html
d1f4dbea8   Ryan Glover   Additional README...
4
5
6
7
  ###
  
  # Created
  Template.signup.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.signup.rendered = ->
5f6f6fbb0   Ryan Glover   Clean up spacing....
12
    # Code to run when template is rendered goes here.
d1f4dbea8   Ryan Glover   Additional README...
13
14
15
  
  # Helpers
  Template.signup.helpers(
5f6f6fbb0   Ryan Glover   Clean up spacing....
16
17
    example: ->
      # Code to run for helper function.
d1f4dbea8   Ryan Glover   Additional README...
18
19
20
21
  )
  
  # Events
  Template.signup.events(
5f6f6fbb0   Ryan Glover   Clean up spacing....
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    'submit form': (e,t) ->
  
      # Prevent form from submitting.
      e.preventDefault()
  
      # Grab the user's details.
      user =
          email: t.find('[name="emailAddress"]').value
          password: t.find('[name="password"]').value
  
      # Create the user's account.
      Meteor.call 'createUserAccount', user, (error) ->
  
          # If the account is created successfully, log the user in using the credentials
          # from above.
          if error
              alert error.reason
          else
              Meteor.loginWithPassword(user.email, user.password, (error)->
                  alert error.reason if error
              )
d1f4dbea8   Ryan Glover   Additional README...
43
  )