diff --git a/matrix_appservice_kakaotalk/commands/auth.py b/matrix_appservice_kakaotalk/commands/auth.py index 6b76e62..e604881 100644 --- a/matrix_appservice_kakaotalk/commands/auth.py +++ b/matrix_appservice_kakaotalk/commands/auth.py @@ -78,6 +78,21 @@ async def login(evt: CommandEvent) -> None: email = evt.args[0 if not save else 1] if num_args > 0 else None if email: + try: + creds = await LoginCredential.get_by_mxid(evt.sender.mxid) + except: + evt.log.exception("Exception while looking for saved password") + creds = None + if creds and creds.email == email: + await evt.reply("Logging in with saved password") + evt.sender.command_status = { + "action": "Login with saved password", + "room_id": evt.room_id, + "save": True, + } + await _login_with_password(evt, email, creds.password, evt.sender.force_login) + return + evt.sender.command_status = { "action": "Login", "room_id": evt.room_id, @@ -86,20 +101,6 @@ async def login(evt: CommandEvent) -> None: "save": save, "forced": evt.sender.force_login, } - try: - creds = await LoginCredential.get_by_mxid(evt.sender.mxid) - except: - evt.log.exception("Exception while looking for saved password") - creds = None - if creds and creds.email == email: - await evt.reply("Logging in with saved password") - await _login_with_password( - evt, - evt.sender.command_status.pop("email"), - creds.password, - evt.sender.command_status.pop("forced"), - ) - return """ TODO Implement web login if evt.bridge.public_website: