     onBeforeAction: ->
       Session.set('buttonText', 'in')
       @next()
+    onStop: ->
+      Session.set('entryError', undefined)
     onRun: ->
       if Meteor.userId()
         Router.go AccountsEntry.settings.dashboardRoute

  @route "entrySignUp",
    path: "/sign-up"
    onBeforeAction: ->
      Session.set('entryError', undefined)
      Session.set('buttonText', 'up')
      @next()
    onRun: ->
      if AccountsEntry.settings.signUpTemplate
        @template = AccountsEntry.settings.signUpTemplate


  @route "entryForgotPassword",
    path: "/forgot-password"
    onStop: ->
      Session.set('entryError', undefined)

  @route 'entrySignOut',
    path: '/sign-out'
    onBeforeAction: ()->
      if not AccountsEntry.settings.homeRoute
        @next()
      else
        Meteor.logout () ->
          Router.go AccountsEntry.settings.homeRoute
    onStop: ->
      Session.set('entryError', undefined)

  @route 'entryVerificationPending',
    path: '/verification-pending'
    onStop: ->
      Session.set('entryError', undefined)

  @route 'entryResetPassword',
    path: 'reset-password/:resetToken'
    onBeforeAction: ->
      Session.set('resetToken', @params.resetToken)
      @next()
    onStop: ->
      Session.set('entryError', undefined)

  @route 'entryEnrollAccount',
    path: 'enroll-account/:resetToken'
    onBeforeAction: ->
      Session.set('resetToken', @params.resetToken)
      @next()
    onStop: ->
      Session.set('entryError', undefined)

# Get all the accounts-entry routes one time
exclusions = []
