"login" command: Don't delete saved password when using it
This commit is contained in:
parent
b8b451b751
commit
54c772d3ac
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue