mirror of
https://github.com/moparisthebest/mail
synced 2025-02-16 23:20:09 -05:00
Bind email addresses in pgp keychain to autocomplete
This commit is contained in:
parent
400a90f88e
commit
a600aaea87
@ -63,6 +63,7 @@ define(function(require) {
|
|||||||
$scope.body = '';
|
$scope.body = '';
|
||||||
$scope.ciphertextPreview = '';
|
$scope.ciphertextPreview = '';
|
||||||
$scope.attachments = [];
|
$scope.attachments = [];
|
||||||
|
$scope.addressBookCache = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportBug() {
|
function reportBug() {
|
||||||
@ -214,7 +215,7 @@ define(function(require) {
|
|||||||
* Verify email address and fetch its public key
|
* Verify email address and fetch its public key
|
||||||
*/
|
*/
|
||||||
$scope.verify = function(recipient) {
|
$scope.verify = function(recipient) {
|
||||||
if(!recipient) {
|
if (!recipient) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +232,7 @@ define(function(require) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// keychainDao is undefined in local dev environment
|
// keychainDao is undefined in local dev environment
|
||||||
if(keychainDao) {
|
if (keychainDao) {
|
||||||
// check if to address is contained in known public keys
|
// check if to address is contained in known public keys
|
||||||
// when we write an email, we always need to work with the latest keys available
|
// when we write an email, we always need to work with the latest keys available
|
||||||
keychainDao.refreshKeyForUserId(recipient.address, function(err, key) {
|
keychainDao.refreshKeyForUserId(recipient.address, function(err, key) {
|
||||||
@ -403,22 +404,42 @@ define(function(require) {
|
|||||||
|
|
||||||
$scope.tagStyle = function(recipient) {
|
$scope.tagStyle = function(recipient) {
|
||||||
var classes = ['label'];
|
var classes = ['label'];
|
||||||
if(recipient.secure === false) {
|
if (recipient.secure === false) {
|
||||||
classes.push('label-primary');
|
classes.push('label-primary');
|
||||||
}
|
}
|
||||||
return classes;
|
return classes;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.lookupAddressBook = function(/*query*/) {
|
$scope.lookupAddressBook = function(query) {
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
|
|
||||||
deferred.resolve([
|
if (!$scope.addressBookCache) {
|
||||||
{ address: 'john@doe.com' },
|
// populate address book cache
|
||||||
{ address: 'jane@doe.com' },
|
keychainDao.listLocalPublicKeys(function(err, keys) {
|
||||||
{ address: 'john.doe@example.com' },
|
if (err) {
|
||||||
{ address: 'jane.doe@example.com' },
|
$scope.onError(err);
|
||||||
{ address: 'max.mustermann@example.com' },
|
return;
|
||||||
]);
|
}
|
||||||
|
|
||||||
|
$scope.addressBookCache = keys.map(function(key) {
|
||||||
|
return {
|
||||||
|
address: key.userId
|
||||||
|
};
|
||||||
|
});
|
||||||
|
filter();
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
filter();
|
||||||
|
}
|
||||||
|
|
||||||
|
// query address book cache
|
||||||
|
function filter() {
|
||||||
|
var addresses = $scope.addressBookCache.filter(function(i) {
|
||||||
|
return i.address.indexOf(query) !== -1;
|
||||||
|
});
|
||||||
|
deferred.resolve(addresses);
|
||||||
|
}
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
@ -500,7 +521,7 @@ define(function(require) {
|
|||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
var model = $parse(attrs.focusInput);
|
var model = $parse(attrs.focusInput);
|
||||||
scope.$watch(model, function(value) {
|
scope.$watch(model, function(value) {
|
||||||
if(value === true) {
|
if (value === true) {
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
element.find('input').first().focus();
|
element.find('input').first().focus();
|
||||||
}, 100);
|
}, 100);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
tag-style="tagStyle" display-property="address" on-tag-added="verify($tag)"
|
tag-style="tagStyle" display-property="address" on-tag-added="verify($tag)"
|
||||||
allowed-tags-pattern='^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
allowed-tags-pattern='^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
||||||
placeholder="add recipient">
|
placeholder="add recipient">
|
||||||
<auto-complete source="lookupAddressBook($query)"></auto-complete>
|
<auto-complete source="lookupAddressBook($query)" min-length="1"></auto-complete>
|
||||||
</tags-input>
|
</tags-input>
|
||||||
</p>
|
</p>
|
||||||
<p ng-show="showCC === true"
|
<p ng-show="showCC === true"
|
||||||
@ -28,7 +28,7 @@
|
|||||||
tag-style="tagStyle" display-property="address" on-tag-added="verify($tag)"
|
tag-style="tagStyle" display-property="address" on-tag-added="verify($tag)"
|
||||||
allowed-tags-pattern='^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
allowed-tags-pattern='^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
||||||
placeholder="add cc">
|
placeholder="add cc">
|
||||||
<auto-complete source="lookupAddressBook($query)"></auto-complete>
|
<auto-complete source="lookupAddressBook($query)" min-length="1"></auto-complete>
|
||||||
</tags-input>
|
</tags-input>
|
||||||
</p>
|
</p>
|
||||||
<p ng-show="showBCC === true"
|
<p ng-show="showBCC === true"
|
||||||
@ -39,7 +39,7 @@
|
|||||||
tag-style="tagStyle" display-property="address" on-tag-added="verify($tag)"
|
tag-style="tagStyle" display-property="address" on-tag-added="verify($tag)"
|
||||||
allowed-tags-pattern='^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
allowed-tags-pattern='^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
||||||
placeholder="add bcc">
|
placeholder="add bcc">
|
||||||
<auto-complete source="lookupAddressBook($query)"></auto-complete>
|
<auto-complete source="lookupAddressBook($query)" min-length="1"></auto-complete>
|
||||||
</tags-input>
|
</tags-input>
|
||||||
</p>
|
</p>
|
||||||
</div><!--/.mail-addresses-->
|
</div><!--/.mail-addresses-->
|
||||||
|
Loading…
Reference in New Issue
Block a user