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"
}
Merge pull request #134 from tarunbhardwaj/fix_login_required

Modify @login_required to handle xhr
Nereid configuration wizard should come in last #3789
Merge pull request #138 from prakashpp/feature/task-3789

Nereid configuration wizard should come in last #3789