1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-25 12:15:18 +01:00

handle success and error conditions when autofilling current tab

This commit is contained in:
Kyle Spearrin 2016-09-14 22:14:06 -04:00
parent 644b074ff9
commit 0a201ef887
2 changed files with 13 additions and 7 deletions

View File

@ -1,7 +1,7 @@
angular
.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,
tabId = null;
$scope.canAutofill = false;
@ -95,7 +95,12 @@ angular
chrome.tabs.sendMessage(tabId, {
command: 'fillForm',
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
// for common login form attribute.
for (i = 0; i < passwordForms.length; i++) {
var formDescriptor = (passwordForms[i].htmlName + '~' + passwordForms[i].htmlId
+ '~' + passwordForms[i].htmlAction).toLowerCase();
var formDescriptor = (passwordForms[i].htmlName + '~' + passwordForms[i].htmlId +
'~' + passwordForms[i].htmlAction).toLowerCase();
if (formDescriptor.indexOf('login') !== -1 || formDescriptor.indexOf('log-in') !== -1
|| formDescriptor.indexOf('signin') !== -1 || formDescriptor.indexOf('sign-in') !== -1
|| formDescriptor.indexOf('logon') !== -1 || formDescriptor.indexOf('log-on') !== -1) {
if (formDescriptor.indexOf('login') !== -1 || formDescriptor.indexOf('log-in') !== -1 ||
formDescriptor.indexOf('signin') !== -1 || formDescriptor.indexOf('sign-in') !== -1 ||
formDescriptor.indexOf('logon') !== -1 || formDescriptor.indexOf('log-on') !== -1) {
loginForm = passwordForms[i];
break;
}

View File

@ -10,6 +10,7 @@
}
.toast {
opacity: 1 !important;
background-image: none !important;
border-radius: 0;
.box-shadow(0 0 8px rgba(0, 0, 0, 0.5));