mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-29 17:20:11 +08:00
Invalidate account.secretes on failure to lo in
This commit is contained in:
parent
ed37609731
commit
2a417445a7
@ -119,18 +119,24 @@ internal class SsoProcessorImpl(
|
|||||||
@Throws(LoginFailedException::class)
|
@Throws(LoginFailedException::class)
|
||||||
override suspend fun login(handler: NetworkHandler) = withExceptionCollector {
|
override suspend fun login(handler: NetworkHandler) = withExceptionCollector {
|
||||||
components[BdhSessionSyncer].loadServerListFromCache()
|
components[BdhSessionSyncer].loadServerListFromCache()
|
||||||
if (client.wLoginSigInfoInitialized) {
|
try {
|
||||||
ssoContext.bot.components[EcdhInitialPublicKeyUpdater].refreshInitialPublicKeyAndApplyECDH()
|
if (client.wLoginSigInfoInitialized) {
|
||||||
kotlin.runCatching {
|
ssoContext.bot.components[EcdhInitialPublicKeyUpdater].refreshInitialPublicKeyAndApplyECDH()
|
||||||
FastLoginImpl(handler).doLogin()
|
kotlin.runCatching {
|
||||||
}.onFailure { e ->
|
FastLoginImpl(handler).doLogin()
|
||||||
collectException(e)
|
}.onFailure { e ->
|
||||||
|
collectException(e)
|
||||||
|
SlowLoginImpl(handler).doLogin()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
client = createClient(ssoContext.bot)
|
||||||
|
ssoContext.bot.components[EcdhInitialPublicKeyUpdater].refreshInitialPublicKeyAndApplyECDH()
|
||||||
SlowLoginImpl(handler).doLogin()
|
SlowLoginImpl(handler).doLogin()
|
||||||
}
|
}
|
||||||
} else {
|
} catch (e: Exception) {
|
||||||
client = createClient(ssoContext.bot)
|
// Failed to log in, invalidate secrets.
|
||||||
ssoContext.bot.components[EcdhInitialPublicKeyUpdater].refreshInitialPublicKeyAndApplyECDH()
|
ssoContext.bot.components[AccountSecretsManager].invalidate()
|
||||||
SlowLoginImpl(handler).doLogin()
|
throw e
|
||||||
}
|
}
|
||||||
components[AccountSecretsManager].saveSecrets(ssoContext.account, AccountSecretsImpl(client))
|
components[AccountSecretsManager].saveSecrets(ssoContext.account, AccountSecretsImpl(client))
|
||||||
registerClientOnline(handler)
|
registerClientOnline(handler)
|
||||||
|
Loading…
Reference in New Issue
Block a user