aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/provider-approval.js
diff options
context:
space:
mode:
authorBruno Barbieri <bruno.barbieri@consensys.net>2018-11-07 08:21:33 +0800
committerGitHub <noreply@github.com>2018-11-07 08:21:33 +0800
commit68138e178e3bb9b06e099a0c9eb8ed833356056f (patch)
tree79bb65fc10c46111a847e4e32681edd7dc43d7a9 /app/scripts/controllers/provider-approval.js
parent7b8a73b01f539bd6b36469487404a7f3bac06c68 (diff)
parent6daf74925189cb05a656bdd4d361beebf235be85 (diff)
downloadtangerine-wallet-browser-68138e178e3bb9b06e099a0c9eb8ed833356056f.tar
tangerine-wallet-browser-68138e178e3bb9b06e099a0c9eb8ed833356056f.tar.gz
tangerine-wallet-browser-68138e178e3bb9b06e099a0c9eb8ed833356056f.tar.bz2
tangerine-wallet-browser-68138e178e3bb9b06e099a0c9eb8ed833356056f.tar.lz
tangerine-wallet-browser-68138e178e3bb9b06e099a0c9eb8ed833356056f.tar.xz
tangerine-wallet-browser-68138e178e3bb9b06e099a0c9eb8ed833356056f.tar.zst
tangerine-wallet-browser-68138e178e3bb9b06e099a0c9eb8ed833356056f.zip
Merge pull request #5689 from MetaMask/reject-cached-approval
EIP-1102: Clear approvals on rejection
Diffstat (limited to 'app/scripts/controllers/provider-approval.js')
-rw-r--r--app/scripts/controllers/provider-approval.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/scripts/controllers/provider-approval.js b/app/scripts/controllers/provider-approval.js
index f17220cb9..d3b7f6dff 100644
--- a/app/scripts/controllers/provider-approval.js
+++ b/app/scripts/controllers/provider-approval.js
@@ -54,7 +54,7 @@ class ProviderApprovalController {
_handleProviderRequest (origin, siteTitle, siteImage, force) {
this.store.updateState({ providerRequests: [{ origin, siteTitle, siteImage }] })
const isUnlocked = this.keyringController.memStore.getState().isUnlocked
- if (!force && this.isApproved(origin) && this.caching && isUnlocked) {
+ if (!force && this.approvedOrigins[origin] && this.caching && isUnlocked) {
this.approveProviderRequest(origin)
return
}
@@ -67,9 +67,11 @@ class ProviderApprovalController {
* @param {string} origin - Origin of the window
*/
_handleIsApproved (origin) {
- const isApproved = this.isApproved(origin) && this.caching
- const caching = this.caching
- this.platform && this.platform.sendMessage({ action: 'answer-is-approved', isApproved, caching }, { active: true })
+ this.platform && this.platform.sendMessage({
+ action: 'answer-is-approved',
+ isApproved: this.approvedOrigins[origin] && this.caching,
+ caching: this.caching,
+ }, { active: true })
}
/**
@@ -117,6 +119,7 @@ class ProviderApprovalController {
this.platform && this.platform.sendMessage({ action: 'reject-provider-request' }, { active: true })
const providerRequests = requests.filter(request => request.origin !== origin)
this.store.updateState({ providerRequests })
+ delete this.approvedOrigins[origin]
}
/**
@@ -127,12 +130,12 @@ class ProviderApprovalController {
}
/**
- * Determines if a given origin has been approved
+ * Determines if a given origin should have accounts exposed
*
* @param {string} origin - Domain origin to check for approval status
* @returns {boolean} - True if the origin has been approved
*/
- isApproved (origin) {
+ shouldExposeAccounts (origin) {
const privacyMode = this.preferencesController.getFeatureFlags().privacyMode
return !privacyMode || this.approvedOrigins[origin]
}