Do not trigger autocomplete fix if the browser is Safari and there's an input with type password, since the Safari does not respect autocomplete = off

- Fix password autofill issue in compose dialog
This commit is contained in:
Hadi Nategh 2015-09-24 07:34:04 +00:00
parent d008e8d378
commit 440e2348a6

View File

@ -596,6 +596,16 @@ etemplate2.prototype.autocomplete_fixer = function ()
{ {
var self = this; var self = this;
var form = self.DOMContainer; var form = self.DOMContainer;
// Safari always do the autofill for password field regardless of autocomplete = off
// and since there's no other way to switch the autocomplete of, we should switch the
// form autocomplete off (e.g. compose dialog, attachment password field)
if (navigator.userAgent.match(/safari/i) && !navigator.userAgent.match(/chrome/i)
&& jQuery('input[type="password"]').length > 0)
{
return;
}
if (form) if (form)
{ {
// Stop submit propagation in order to not fire other possible submit events // Stop submit propagation in order to not fire other possible submit events