heartsentwined/ember-auth — pull request #16 by iHiD (2013-04-02 02:43:54+00:00)
Title: JSONP doesn't support async: false, so fails with redirecting

There are currently sync problems with JSONP as the router redirect fires before the request comes back. The most robust way I've found to fix this is to change the redirect section to:

```javascript
Auth.Route.reopen({
redirect: function() {
if (Auth.Config.get('rememberMe') && Auth.Config.get('rememberAutoRecall')) {
request = Auth.Module.RememberMe.recall({async: true})
if(request) {
window.Meducation.theRequest = request
self = this;
callback = this._super;
return request.always(function() {
callback.call(self)
});
}
}
return this._super();
}
});
```

I've also changed to the new deferred jQuery methods, as the old callbacks don't play nicely with JSONP either (e.g. no error callback).

I've tested this lots with JSONP and it's working great now, but you might like to give it a run through on standard JSON, just in case I've missed anything.

This contains the same functionality as my other pull request, so if you pull this, you can ignore the other, but if you want to discuss this in more detail, the other one is a nice quick fix. Thanks! :smiley_cat: