示例#1
0
    async def remove_cloud_password(self, password: str) -> bool:
        """Use this method to turn off the Two-Step Verification security feature (Cloud Password) on your account.

        Args:
            password (``str``):
                Your current password.

        Returns:
            True on success.

        Raises:
            :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
            ``ValueError`` in case there is no cloud password to remove.
        """
        r = await self.send(functions.account.GetPassword())

        if not r.has_password:
            raise ValueError("There is no cloud password to remove")

        await self.send(
            functions.account.UpdatePasswordSettings(
                password=compute_check(r, password),
                new_settings=types.account.PasswordInputSettings(
                    new_algo=types.PasswordKdfAlgoUnknown(),
                    new_password_hash=b"",
                    hint="")))

        return True
示例#2
0
    async def remove_cloud_password(self, password: str) -> bool:
        """Turn off the Two-Step Verification security feature (Cloud Password) on your account.

        Parameters:
            password (``str``):
                Your current password.

        Returns:
            ``bool``: True on success.

        Raises:
            ValueError: In case there is no cloud password to remove.

        Example:
            .. code-block:: python

                app.remove_cloud_password("password")
        """
        r = await self.send(functions.account.GetPassword())

        if not r.has_password:
            raise ValueError("There is no cloud password to remove")

        await self.send(
            functions.account.UpdatePasswordSettings(
                password=compute_check(r, password),
                new_settings=types.account.PasswordInputSettings(
                    new_algo=types.PasswordKdfAlgoUnknown(),
                    new_password_hash=b"",
                    hint="")))

        return True