Skip to content

Commit

Permalink
fix account error when id token is not found and fix account migration
Browse files Browse the repository at this point in the history
  • Loading branch information
blarfoon committed Nov 18, 2024
1 parent d041c46 commit 40c1edf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ALTER TABLE "new_AppConfiguration" RENAME TO "AppConfiguration";
CREATE UNIQUE INDEX "AppConfiguration_id_key" ON "AppConfiguration"("id");

-- reset since azure app id changed
UPDATE "Account" SET "accessToken" = NULL, "tokenExpires" = NULL, "msRefreshToken" = NULL, "idToken" = NULL;
UPDATE "Account" SET "accessToken" = "invalid", "msRefreshToken" = "invalid", "idToken" = "invalid";

PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;
14 changes: 7 additions & 7 deletions crates/carbon_app/src/managers/account/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ impl<'s> ManagerRef<'s, AccountManager> {
))?
.id_token
else {
bail!("attempted to get an account that does not exist");
bail!("this account is present in the db but the id_token is missing. Presumably offline account. (uuid: {uuid})");
};

info!("Waiting for account validation");
Expand All @@ -232,7 +232,7 @@ impl<'s> ManagerRef<'s, AccountManager> {
))?
.id_token
else {
bail!("attempted to get an account that does not exist");
bail!("this account is present in the db but the id_token is missing. Presumably offline account. (uuid: {uuid})");
};

let account = self.gdl_account_task.read().await;
Expand All @@ -257,7 +257,7 @@ impl<'s> ManagerRef<'s, AccountManager> {
.id_token
else {
return Err(RequestGDLAccountDeletionError::RequestFailed(
anyhow::anyhow!("attempted to get an account that does not exist"),
anyhow::anyhow!("this account is present in the db but the id_token is missing. Presumably offline account. (uuid: {uuid})")
));
};

Expand Down Expand Up @@ -294,7 +294,7 @@ impl<'s> ManagerRef<'s, AccountManager> {
))?
.id_token
else {
bail!("attempted to get an account that does not exist");
bail!("this account is present in the db but the id_token is missing. Presumably offline account. (uuid: {uuid})");
};

let lock = self.gdl_account_task.write().await;
Expand Down Expand Up @@ -354,7 +354,7 @@ impl<'s> ManagerRef<'s, AccountManager> {
))?
.id_token
else {
bail!("attempted to get an account that does not exist");
bail!("this account is present in the db but the id_token is missing. Presumably offline account. (uuid: {saved_gdl_account_uuid})")
};

let Some(user) = self
Expand Down Expand Up @@ -386,7 +386,7 @@ impl<'s> ManagerRef<'s, AccountManager> {
.id_token
else {
return Err(RequestNewVerificationTokenError::RequestFailed(
anyhow::anyhow!("attempted to get an account that does not exist"),
anyhow::anyhow!("this account is present in the db but the id_token is missing. Presumably offline account. (uuid: {uuid})")
));
};

Expand Down Expand Up @@ -419,7 +419,7 @@ impl<'s> ManagerRef<'s, AccountManager> {
.id_token
else {
return Err(RequestNewEmailChangeError::RequestFailed(anyhow::anyhow!(
"attempted to get an account that does not exist"
"this account is present in the db but the id_token is missing. Presumably offline account. (uuid: {uuid})"
)));
};

Expand Down

0 comments on commit 40c1edf

Please sign in to comment.