#NEWLINE# def authenticate( self , username = None , password = None , token = None ) : #NEWLINE# #INDENT# user_or_none = super ( TwoFactorAuthBackend , self ) . authenticate ( username , password ) #NEWLINE# if ( user_or_none and isinstance ( user_or_none , User ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# user_token = UserAuthToken . objects . get ( user = user_or_none ) #NEWLINE# #UNINDENT# except UserAuthToken . DoesNotExist : #NEWLINE# #INDENT# return user_or_none #NEWLINE# #UNINDENT# validate = user_token . check_auth_code ( user_or_none ) #NEWLINE# if ( validate == True ) : #NEWLINE# #INDENT# return user_or_none #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# return user_or_none