Fixed MatrixBotConfig.allow_ainput_password
`MatrixBotConfig.allow_ainput_password` was ignored before this commit because it was forgotten about during refactoring
This commit is contained in:
@@ -17,11 +17,14 @@ class ClientAuth:
|
|||||||
#
|
#
|
||||||
# PRIVATE
|
# PRIVATE
|
||||||
#
|
#
|
||||||
@staticmethod
|
async def _default_password_callback(self) -> str:
|
||||||
async def _default_password_callback() -> str:
|
if self._config is None:
|
||||||
|
raise RuntimeError("No config")
|
||||||
if "MATRIX_PASSWORD" in os.environ:
|
if "MATRIX_PASSWORD" in os.environ:
|
||||||
return os.environ["MATRIX_PASSWORD"]
|
return os.environ["MATRIX_PASSWORD"]
|
||||||
return await aioconsole.ainput("Matrix password: ")
|
if self._config.allow_ainput_password:
|
||||||
|
return await aioconsole.ainput("Matrix password: ")
|
||||||
|
raise RuntimeError("Can't get password")
|
||||||
|
|
||||||
async def _login_using_session_data(self, client: AsyncClient) -> None:
|
async def _login_using_session_data(self, client: AsyncClient) -> None:
|
||||||
"""
|
"""
|
||||||
@@ -98,11 +101,13 @@ class ClientAuth:
|
|||||||
self._logger = logging.getLogger("ClientAuth")
|
self._logger = logging.getLogger("ClientAuth")
|
||||||
self._storage = storage
|
self._storage = storage
|
||||||
self._full_matrix_username: str | None = None
|
self._full_matrix_username: str | None = None
|
||||||
|
self._config: MatrixBotConfig | None = None
|
||||||
|
|
||||||
async def setup(self, config: MatrixBotConfig) -> None:
|
async def setup(self, config: MatrixBotConfig) -> None:
|
||||||
"""
|
"""
|
||||||
Setup `ClientAuth` object using `config`.
|
Setup `ClientAuth` object using `config`.
|
||||||
"""
|
"""
|
||||||
|
self._config = config
|
||||||
self._full_matrix_username = Utils.build_full_matrix_username(config)
|
self._full_matrix_username = Utils.build_full_matrix_username(config)
|
||||||
|
|
||||||
async def login(self, client: AsyncClient) -> None:
|
async def login(self, client: AsyncClient) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user