From 45b9d9e74540452719b632a567e79b19067d863a Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 23 Sep 2015 15:51:46 +0000 Subject: [PATCH] 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 --- etemplate/js/etemplate2.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index 9ed91d0c89..25356f9059 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -607,6 +607,16 @@ etemplate2.prototype.autocomplete_fixer = function () { var self = this; 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) { // Stop submit propagation in order to not fire other possible submit events