mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-22 11:45:59 +01:00
handle success and error conditions when autofilling current tab
This commit is contained in:
parent
644b074ff9
commit
0a201ef887
@ -1,7 +1,7 @@
|
|||||||
angular
|
angular
|
||||||
.module('bit.current')
|
.module('bit.current')
|
||||||
|
|
||||||
.controller('currentController', function ($scope, siteService, cipherService, tldjs, toastr, $q) {
|
.controller('currentController', function ($scope, siteService, cipherService, tldjs, toastr, $q, $window) {
|
||||||
var pageDetails = null,
|
var pageDetails = null,
|
||||||
tabId = null;
|
tabId = null;
|
||||||
$scope.canAutofill = false;
|
$scope.canAutofill = false;
|
||||||
@ -95,7 +95,12 @@ angular
|
|||||||
chrome.tabs.sendMessage(tabId, {
|
chrome.tabs.sendMessage(tabId, {
|
||||||
command: 'fillForm',
|
command: 'fillForm',
|
||||||
fillScript: fillScript
|
fillScript: fillScript
|
||||||
}, function () { });
|
}, function () {
|
||||||
|
$window.close()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
toastr.error('Unable to auto-fill the selected site. Copy/paste your username and/or password instead.');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -143,12 +148,12 @@ angular
|
|||||||
// First let's try to guess the correct login form by examining the form attribute strings
|
// First let's try to guess the correct login form by examining the form attribute strings
|
||||||
// for common login form attribute.
|
// for common login form attribute.
|
||||||
for (i = 0; i < passwordForms.length; i++) {
|
for (i = 0; i < passwordForms.length; i++) {
|
||||||
var formDescriptor = (passwordForms[i].htmlName + '~' + passwordForms[i].htmlId
|
var formDescriptor = (passwordForms[i].htmlName + '~' + passwordForms[i].htmlId +
|
||||||
+ '~' + passwordForms[i].htmlAction).toLowerCase();
|
'~' + passwordForms[i].htmlAction).toLowerCase();
|
||||||
|
|
||||||
if (formDescriptor.indexOf('login') !== -1 || formDescriptor.indexOf('log-in') !== -1
|
if (formDescriptor.indexOf('login') !== -1 || formDescriptor.indexOf('log-in') !== -1 ||
|
||||||
|| formDescriptor.indexOf('signin') !== -1 || formDescriptor.indexOf('sign-in') !== -1
|
formDescriptor.indexOf('signin') !== -1 || formDescriptor.indexOf('sign-in') !== -1 ||
|
||||||
|| formDescriptor.indexOf('logon') !== -1 || formDescriptor.indexOf('log-on') !== -1) {
|
formDescriptor.indexOf('logon') !== -1 || formDescriptor.indexOf('log-on') !== -1) {
|
||||||
loginForm = passwordForms[i];
|
loginForm = passwordForms[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.toast {
|
.toast {
|
||||||
|
opacity: 1 !important;
|
||||||
background-image: none !important;
|
background-image: none !important;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
.box-shadow(0 0 8px rgba(0, 0, 0, 0.5));
|
.box-shadow(0 0 8px rgba(0, 0, 0, 0.5));
|
||||||
|
Loading…
Reference in New Issue
Block a user