openlabs/nereid — pull request #134 by tarunbhardwaj (2014-02-01 11:25:59+00:00)
Title: Modify @login_required to handle xhr

@login_required will return 401 with json for xhr request for guest
user. As design followed by github.
Refer: http://developer.github.com/v3/#failed-login-limit

Detailed response is as following:

Status: 401 UNAUTHORIZED
Body:
{
"error":true,
"reason":"This request can only be completed after login"
}