mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-26 01:53:13 +08:00
fix(identity): Log user out of app if identity token is missing
This commit is contained in:
parent
d47c5bf3dd
commit
9ac730cccc
1 changed files with 10 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
import request from 'request'
|
||||
import {remote} from 'electron'
|
||||
import Utils from './models/utils'
|
||||
import Actions from './actions'
|
||||
import {APIError} from './errors'
|
||||
|
@ -35,7 +36,15 @@ export default class NylasAPIRequest {
|
|||
|
||||
const identity = IdentityStore.identity();
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue