def by_credentials(cls, session, login, password):
        """
        Get a user from given credentials

        :param session: SQLAlchemy session
        :type session: :class:`sqlalchemy.Session`

        :param login: username
        :type login: unicode

        :param password: user password
        :type password: unicode

        :return: associated user
        :rtype: :class:`pyshop.models.User`
        """
        user = cls.by_login(session, login, local=True)
        if not user:
            return None
        if crypt.check(user.password, password):
            return user
def by_credentials ( cls , session , login , password ) : user = cls . by_login ( session , login , local = True ) if not user : return None if crypt . check ( user . password , password ) : return user
Get a user from given credentials

        :param session: SQLAlchemy session
        :type session: :class:`sqlalchemy.Session`

        :param login: username
        :type login: unicode

        :param password: user password
        :type password: unicode

        :return: associated user
        :rtype: :class:`pyshop.models.User`