             logger.warn("Couldn't register user: #{err}")
         )
 
-        return false
+        Session.set("isInSignupMode", false)
+        false
       ,
     })
     Template.forgotPassword.helpers({

  return t.find('.account-password').value

class @LoginService
  constructor: ->
    Session.set("loginForm", "signin")

  setupTemplate: ->
    Template.login.helpers({
      showSignIn: ->
        return Session.get("loginForm") == "signin"
      ,
      showSignUp: ->
        return Session.get("loginForm") == "signup"
      ,
    })
    Template.login.events({
      "click #login-signin-tab": ->
        if Session.get("loginForm") == "signin"
          return

        logger.debug("Showing signin form")

        $("##{idSignup}").removeClass('active')
        $("#signin-email").focus()
        # Display form corresponding to tab
        Session.set("isInSignupMode", false)
      "click #login-signup-tab": ->
        if Session.get("isInSignupMode")
          return

        $("##{idSignup}").addClass('active')
        $("##{idSignIn}").removeClass('active')
        $("#signup-email").focus()
        logger.debug("Showing signup form")
        Session.set("isInSignupMode", true)
      ,
      'submit #signin-form': (e, t) ->
        e.preventDefault()
