Prevent auth dialog when failed to login in assistant and then successfully login another account

This commit is contained in:
Sylvain Berfini 2025-07-04 10:15:50 +02:00
parent 39b68097ee
commit d69a797b25
2 changed files with 5 additions and 2 deletions

View file

@ -498,12 +498,13 @@ class CoreContext
if (account.findAuthInfo() == digestAuthInfoPendingPasswordUpdate) { if (account.findAuthInfo() == digestAuthInfoPendingPasswordUpdate) {
Log.i("$TAG Removed account matches auth info pending password update, removing dialog") Log.i("$TAG Removed account matches auth info pending password update, removing dialog")
clearAuthenticationRequestDialogEvent.postValue(Event(true)) clearAuthenticationRequestDialogEvent.postValue(Event(true))
digestAuthInfoPendingPasswordUpdate = null
} }
if (core.defaultAccount == null || core.defaultAccount == account) { if (core.defaultAccount == null || core.defaultAccount == account) {
Log.w("$TAG Removed account was the default one, choosing another as default if possible") Log.w("$TAG Removed account was the default one, choosing another as default if possible")
val newDefaultAccount = core.accountList.find { val newDefaultAccount = core.accountList.find {
it.params.isRegisterEnabled == true it.params.isRegisterEnabled
} ?: core.accountList.firstOrNull() } ?: core.accountList.firstOrNull()
if (newDefaultAccount == null) { if (newDefaultAccount == null) {
Log.e("$TAG Failed to find a new default account!") Log.e("$TAG Failed to find a new default account!")

View file

@ -309,7 +309,9 @@ class MainActivity : GenericActivity() {
coreContext.digestAuthenticationRequestedEvent.observe(this) { coreContext.digestAuthenticationRequestedEvent.observe(this) {
it.consume { identity -> it.consume { identity ->
try { try {
showAuthenticationRequestedDialog(identity) if (coreContext.digestAuthInfoPendingPasswordUpdate != null) {
showAuthenticationRequestedDialog(identity)
}
} catch (e: WindowManager.BadTokenException) { } catch (e: WindowManager.BadTokenException) {
Log.e("$TAG Failed to show authentication dialog: $e") Log.e("$TAG Failed to show authentication dialog: $e")
} }