From 7cd02ca0cfdd333d752b1d105d32329febb599ea Mon Sep 17 00:00:00 2001 From: Gregory Koberger Date: Thu, 17 Feb 2011 18:44:39 -0800 Subject: [PATCH] Randomize password field so password managers don't recognize it (bug 630126) --- .../devhub/addons/listing/delete_form.html | 3 ++- apps/devhub/views.py | 4 +++- media/js/zamboni/devhub.js | 14 +++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/devhub/templates/devhub/addons/listing/delete_form.html b/apps/devhub/templates/devhub/addons/listing/delete_form.html index 40ee0b05079..4a50cb20590 100644 --- a/apps/devhub/templates/devhub/addons/listing/delete_form.html +++ b/apps/devhub/templates/devhub/addons/listing/delete_form.html @@ -14,7 +14,8 @@

{{ _('Delete Add-on') }}

diff --git a/apps/devhub/views.py b/apps/devhub/views.py index 5655f1a58f7..09d6479d729 100644 --- a/apps/devhub/views.py +++ b/apps/devhub/views.py @@ -5,6 +5,7 @@ import os import path import sys +import time import traceback import uuid @@ -805,7 +806,8 @@ def version_list(request, addon_id, addon): new_file_form = forms.NewVersionForm(None, addon=addon) data = {'addon': addon, 'versions': versions, - 'new_file_form': new_file_form} + 'new_file_form': new_file_form, + 'timestamp': int(time.time())} return jingo.render(request, 'devhub/versions/list.html', data) diff --git a/media/js/zamboni/devhub.js b/media/js/zamboni/devhub.js index e97151d5909..e60965aeb7a 100644 --- a/media/js/zamboni/devhub.js +++ b/media/js/zamboni/devhub.js @@ -643,8 +643,20 @@ function initVersions() { return true; }}); + function fixPasswordField() { + // This is a hack to prevent password managers from automatically + // deleting add-ons. See bug 630126. + $(this).find('input[type=password]').each(function(){ + var $this = $(this); + if($this.attr('data-name')) { + $this.attr('name', $this.attr('data-name')); + } + }); + return true; + } + $('#modal-cancel').modal('#cancel-review', {width: 400}); - $('#modal-delete').modal('#delete-addon', {width: 400}); + $('#modal-delete').modal('#delete-addon', {width: 400, callback:fixPasswordField}); $('#modal-disable').modal('#disable-addon', {width: 400, callback: function(d){