A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: force update token if email is already confirmed (#2879)
Abdullah Atta3f0a656a36f3
diff --git a/packages/core/api/sync/index.js b/packages/core/api/sync/index.jsindex a7ddbcdfa..b1cbe4a2a 100644--- a/packages/core/api/sync/index.js+++ b/packages/core/api/sync/index.js@@ -65,6 +65,7 @@ export default class SyncManager {*/constructor(db) {this.sync = new Sync(db);+ this._db = db;}async start(full, force) {@@ -76,6 +77,19 @@ export default class SyncManager {var isHubException = e.message.includes("HubException:");if (isHubException) {var actualError = /HubException: (.*)/gm.exec(e.message);++ // NOTE: sometimes there's the case where the user has already+ // confirmed their email but the server still thinks that it+ // isn't confirmed. This check is added to trigger a force+ // update of the access token.+ if (+ actualError.includes("Please confirm your email ") &&+ (await this._db.user.getUser()).isEmailConfirmed+ ) {+ await this._db.user.tokenManager._refreshToken(true);+ return false;+ }+if (actualError.length > 1) throw new Error(actualError[1]);}throw e;