Fix password entry after migrate

This commit is contained in:
Ali 2021-11-26 13:29:33 +04:00
parent 0133c26c53
commit d940f6571d

View File

@ -103,6 +103,19 @@ public func sendAuthorizationCode(accountManager: AccountManager<TelegramAccount
|> map { sentCode in
return (.sentCode(sentCode), updatedAccount)
}
|> `catch` { error -> Signal<(SendCodeResult, UnauthorizedAccount), MTRpcError> in
if error.errorDescription == "SESSION_PASSWORD_NEEDED" {
return account.network.request(Api.functions.account.getPassword(), automaticFloodWait: false)
|> mapToSignal { result -> Signal<(SendCodeResult, UnauthorizedAccount), MTRpcError> in
switch result {
case let .password(_, _, _, _, hint, _, _, _, _, _):
return .single((.password(hint: hint), account))
}
}
} else {
return .fail(error)
}
}
}
case _:
return .fail(error)