#NEWLINE# def authenticate( self , request ) : #NEWLINE# #INDENT# '\n        Returns a `User` if the request session currently has a logged in user.\n        Otherwise returns `None`.\n        ' #NEWLINE# user = getattr ( request . _request , 'user' , None ) #NEWLINE# if ( ( not user ) or ( not user . is_active ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# self . enforce_csrf ( request ) #NEWLINE# return ( user , None )