1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Mark origins as unapproved if user explicitly locks MetaMask

This commit is contained in:
bitpshr 2018-11-03 11:06:11 +00:00 committed by Dan Finlay
parent f557d33718
commit 9984f7edeb
2 changed files with 5 additions and 3 deletions

View File

@ -49,7 +49,8 @@ class ProviderApprovalController {
*/ */
_handleProviderRequest (origin) { _handleProviderRequest (origin) {
this.store.updateState({ providerRequests: [{ origin }] }) this.store.updateState({ providerRequests: [{ origin }] })
if (this.isApproved(origin) && this.caching) { const isUnlocked = this.keyringController.memStore.getState().isUnlocked
if (this.isApproved(origin) && this.caching && isUnlocked) {
this.approveProviderRequest(origin) this.approveProviderRequest(origin)
return return
} }
@ -128,8 +129,9 @@ class ProviderApprovalController {
* @returns {boolean} - True if the origin has been approved * @returns {boolean} - True if the origin has been approved
*/ */
isApproved (origin) { isApproved (origin) {
const isUnlocked = this.keyringController.memStore.getState().isUnlocked
const privacyMode = this.preferencesController.getFeatureFlags().privacyMode const privacyMode = this.preferencesController.getFeatureFlags().privacyMode
return !privacyMode || this.approvedOrigins[origin] return !privacyMode || (isUnlocked && this.approvedOrigins[origin])
} }
/** /**

View File

@ -65,7 +65,7 @@ inpageProvider.enable = function () {
}) })
}) })
// wait for the background to update with an accoount // wait for the background to update with an account
const ethAccounts = new Promise((resolveAccounts, rejectAccounts) => { const ethAccounts = new Promise((resolveAccounts, rejectAccounts) => {
inpageProvider.sendAsync({ method: 'eth_accounts', params: [] }, (error, response) => { inpageProvider.sendAsync({ method: 'eth_accounts', params: [] }, (error, response) => {
if (error) { if (error) {