def login(cls, email, password):
        """
        Log in a user

        :param email: the user's email address
        :param password: the user's password
        :returns: (User, token)
        :raises: SocketError, CouchException
        """
        try:
            doc = yield cls.view.first(key=email, include_docs=True)
        except couch.NotFound:
            raise exceptions.Unauthorized('Unknown email address')

        user = cls(**doc['doc'])

        verified = user.verify_password(password)
        if not verified:
            raise exceptions.Unauthorized('Invalid password')

        token = yield Token.create(user)
        raise Return((user, token.id))
Log in a user

        :param email: the user's email address
        :param password: the user's password
        :returns: (User, token)
        :raises: SocketError, CouchException