```coffeescript
Wheelmap.ApplicationRoute = Ember.Route.extend
  signedIn: false

  beforeModel: (transition)->
    signUrl = $.cookie('sign_url')

    if signUrl?
      transition.abort()

      $.cookie('sign_url', null)
      window.location.hash = signUrl

  actions:
    authenticate: (transition)->
      self = @

      unless self.signedIn
        transition.abort()

        $.ajax('/users/signed_in').done (signedIn)->
          if signedIn
            self.signedIn = true
            transition.retry()
          else
            params = {}

            $.each transition.params, ->
              $.extend params, @

            $.cookie('sign_url', transition.router.recognizer.generate(transition.targetName, params))
            window.location = '/users/sign_in'```

Fix autoredirect when login failed.
user
```coffeescript
Wheelmap.ApplicationRoute = Ember.Route.extend
  signedIn: false

  beforeModel: (transition)->
    signUrl = $.cookie('sign_url')
    data = JSON.parse $.cookie("flash")

    if signUrl? && !data.error && !data.alert && !data.notice
      transition.abort()

      $.cookie('sign_url', null)
      window.location.hash = signUrl

  actions:
    authenticate: (transition)->
      self = @

      unless self.signedIn
        transition.abort()

        $.ajax('/users/signed_in').done (signedIn)->
          if signedIn
            self.signedIn = true
            transition.retry()
          else
            params = {}

            $.each transition.params, ->
              $.extend params, @

            $.cookie('sign_url', transition.router.recognizer.generate(transition.targetName, params))
            window.location = '/users/sign_in'```
assistant