mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 01:54:40 +08:00
fix(plugin-auth): Once plguin auth succeeds, don't do it again
This commit is contained in:
parent
28b995e19c
commit
68d89504f7
1 changed files with 8 additions and 1 deletions
|
@ -396,6 +396,11 @@ class NylasAPI
|
|||
AccountStore ?= require './stores/account-store'
|
||||
AccountStore.accountForId(accountOrId)
|
||||
Promise.reject(new Error('Invalid account')) unless account
|
||||
|
||||
cacheKey = "plugins.#{pluginId}.lastAuthTimestamp"
|
||||
if NylasEnv.config.get(cacheKey)
|
||||
return Promise.resolve()
|
||||
|
||||
return @makeRequest({
|
||||
returnsModel: false,
|
||||
method: "GET",
|
||||
|
@ -404,9 +409,11 @@ class NylasAPI
|
|||
})
|
||||
.then (result) =>
|
||||
if result.authed
|
||||
NylasEnv.config.set(cacheKey, Date.now())
|
||||
return Promise.resolve()
|
||||
else
|
||||
# return @_requestPluginAuth(pluginName, account).then =>
|
||||
# Enable to show a prompt to the user
|
||||
# return @_requestPluginAuth(pluginName, account).then =>
|
||||
return @makeRequest({
|
||||
returnsModel: false,
|
||||
method: "POST",
|
||||
|
|
Loading…
Reference in a new issue