Skip to content

Commit a2dcab8

Browse files
committed
fix(login): unconditionally proceed with login after account verification
proceedWithLogin() skipped setting the account active and navigating onward whenever the newly stored account already looked like the active user in the DB. Since storeProfile() always inserts new accounts with current=true and the current-user query picks the row with the highest id, this was true for any 2nd+ account added, leaving the verification screen stuck forever. Signed-off-by: Marcel Hibbe <marcel.hibbe@nextcloud.com>
1 parent a124bf7 commit a2dcab8

1 file changed

Lines changed: 11 additions & 22 deletions

File tree

‎app/src/main/java/com/nextcloud/talk/account/AccountVerificationActivity.kt‎

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -519,32 +519,21 @@ class AccountVerificationActivity : BaseActivity() {
519519
private fun proceedWithLogin() {
520520
cookieManager.cookieStore.removeAll()
521521

522-
if (userManager.users.blockingGet().size == 1 ||
523-
currentUserProviderOld.currentUser.blockingGet().id != internalAccountId
524-
) {
525-
val userToSetAsActive = userManager.getUserWithId(internalAccountId).blockingGet()
526-
Log.d(TAG, "userToSetAsActive: " + userToSetAsActive.username)
522+
val userToSetAsActive = userManager.getUserWithId(internalAccountId).blockingGet()
523+
Log.d(TAG, "userToSetAsActive: " + userToSetAsActive.username)
527524

528-
if (userManager.setUserAsActive(userToSetAsActive).blockingGet()) {
529-
runOnUiThread {
530-
if (userManager.users.blockingGet().size == 1) {
531-
val intent = Intent(context, ConversationsListActivity::class.java)
532-
startActivity(intent)
533-
} else {
534-
if (isAccountImport) {
535-
ApplicationWideMessageHolder.getInstance().messageType =
536-
ApplicationWideMessageHolder.MessageType.ACCOUNT_WAS_IMPORTED
537-
}
538-
val intent = Intent(context, ConversationsListActivity::class.java)
539-
startActivity(intent)
540-
}
525+
if (userManager.setUserAsActive(userToSetAsActive).blockingGet()) {
526+
runOnUiThread {
527+
if (userManager.users.blockingGet().size > 1 && isAccountImport) {
528+
ApplicationWideMessageHolder.getInstance().messageType =
529+
ApplicationWideMessageHolder.MessageType.ACCOUNT_WAS_IMPORTED
541530
}
542-
} else {
543-
Log.e(TAG, "failed to set active user")
544-
Snackbar.make(binding.root, R.string.nc_common_error_sorry, Snackbar.LENGTH_LONG).show()
531+
val intent = Intent(context, ConversationsListActivity::class.java)
532+
startActivity(intent)
545533
}
546534
} else {
547-
Log.d(TAG, "continuing proceedWithLogin was skipped for this user")
535+
Log.e(TAG, "failed to set active user")
536+
Snackbar.make(binding.root, R.string.nc_common_error_sorry, Snackbar.LENGTH_LONG).show()
548537
}
549538
}
550539

0 commit comments

Comments
 (0)