From a3a5cd58444d74a0578e172929d165aadeaa862b Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 5 Mar 2023 07:47:35 +0100 Subject: [PATCH] Fixed updating Graph token --- app/src/main/java/eu/faircode/email/DaoIdentity.java | 4 ++-- app/src/main/java/eu/faircode/email/FragmentOAuth.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/DaoIdentity.java b/app/src/main/java/eu/faircode/email/DaoIdentity.java index 4dd88e6cd4..66d66269e6 100644 --- a/app/src/main/java/eu/faircode/email/DaoIdentity.java +++ b/app/src/main/java/eu/faircode/email/DaoIdentity.java @@ -119,9 +119,9 @@ public interface DaoIdentity { " SET password = :password, auth_type = :new_auth_type, provider = :provider" + " WHERE account = :account" + " AND user = :user" + - " AND (auth_type = :auth_type OR auth_type = " + ServiceAuthenticator.AUTH_TYPE_GRAPH + ")" + + " AND (auth_type = :auth_type OR auth_type IS NULL)" + " AND NOT (password IS :password AND auth_type IS :new_auth_type AND provider = :provider)") - int setIdentityPassword(long account, String user, String password, int auth_type, int new_auth_type, String provider); + int setIdentityPassword(long account, String user, String password, Integer auth_type, int new_auth_type, String provider); @Query("UPDATE identity" + " SET fingerprint = :fingerprint" + diff --git a/app/src/main/java/eu/faircode/email/FragmentOAuth.java b/app/src/main/java/eu/faircode/email/FragmentOAuth.java index 8780a66d9d..51d73926d5 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOAuth.java +++ b/app/src/main/java/eu/faircode/email/FragmentOAuth.java @@ -992,7 +992,7 @@ public class FragmentOAuth extends FragmentBase { db.account().setAccountPassword(update.id, state[0], AUTH_TYPE_OAUTH, provider.id); db.identity().setIdentityPassword(update.id, username, state[state.length - 1], - update.auth_type, + null, (state.length == 1 ? AUTH_TYPE_OAUTH : AUTH_TYPE_GRAPH), provider.id); }