mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-23 23:54:13 +08:00
fix(identity): Log user out of app if identity token is missing
This commit is contained in:
parent
d7159e08bb
commit
328267c629
1 changed files with 10 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
import request from 'request'
|
import request from 'request'
|
||||||
|
import {remote} from 'electron'
|
||||||
import Utils from './models/utils'
|
import Utils from './models/utils'
|
||||||
import Actions from './actions'
|
import Actions from './actions'
|
||||||
import {APIError} from './errors'
|
import {APIError} from './errors'
|
||||||
|
@ -35,7 +36,15 @@ export default class NylasAPIRequest {
|
||||||
|
|
||||||
const identity = IdentityStore.identity();
|
const identity = IdentityStore.identity();
|
||||||
if (identity && !identity.token) {
|
if (identity && !identity.token) {
|
||||||
throw new Error("Identity is present but identity token is missing.");
|
const clickedIndex = remote.dialog.showMessageBox({
|
||||||
|
type: 'error',
|
||||||
|
message: 'Identity is present but identity token is missing.',
|
||||||
|
detail: `Actions like sending and receiving mail require this token. Please log back into your Nylas ID to restore it—your email accounts will not be removed in this process.`,
|
||||||
|
buttons: ['Log out'],
|
||||||
|
})
|
||||||
|
if (clickedIndex === 0) {
|
||||||
|
Actions.logoutNylasIdentity()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const accountToken = this.api.accessTokenForAccountId(this.options.accountId);
|
const accountToken = this.api.accessTokenForAccountId(this.options.accountId);
|
||||||
|
|
Loading…
Reference in a new issue