Login function updated to correspond to the one in Django 1.7