(email, password)
return user
Returns the authenticated user or None.
Returns the authenticated user or None.
Returns the authenticated user or None .
def auth_user(email, password):
        """Returns the authenticated user or None."""
        user = User.objects(email=email)

        if not user:
            return None

        # TODO(sandy): Since we added a unique index on email, this shouldn't
        # happen anymore. But keep this around for a bit, in case something
        # messes up [Apr 8, 2014]
        if user.count() > 1:
            logging.error('Multiple email addressed matched: %s' % email)
            return None

        user = user.first()

        # TODO(sandy): Provide more helpful errors for users signed up with fb
        if (not user.password or
            not bcrypt.check_password_hash(user.password, password)):
            return None

        return user
def auth_user ( email , password ) : user = User . objects ( email = email ) if not user : return None # TODO(sandy): Since we added a unique index on email, this shouldn't # happen anymore. But keep this around for a bit, in case something # messes up [Apr 8, 2014] if user . count ( ) > 1 : logging . error ( 'Multiple email addressed matched: %s' % email ) return None user = user . first ( ) # TODO(sandy): Provide more helpful errors for users signed up with fb if ( not user . password or not bcrypt . check_password_hash ( user . password , password ) ) : return None return user