Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
Randomize password field so password managers don't recognize it (bug…
Browse files Browse the repository at this point in the history
… 630126)
  • Loading branch information
gkoberger committed Feb 18, 2011
1 parent ae33eba commit 7cd02ca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/devhub/templates/devhub/addons/listing/delete_form.html
Expand Up @@ -14,7 +14,8 @@ <h3>{{ _('Delete Add-on') }}</h3>
<p>
<label>
{{ _('Enter your password to confirm your decision:') }}
<input type="password" name="password" autocomplete="off">
{# see bug 630126 for why this is called 'password-timestamp' #}
<input type="password" name="password-{{ timestamp }}" data-name="password" autocomplete="off">
</label>
</p>
<input type="hidden" name="addon_id" class="addon_id" value="{{ addon.id }}">
Expand Down
4 changes: 3 additions & 1 deletion apps/devhub/views.py
Expand Up @@ -5,6 +5,7 @@
import os
import path
import sys
import time
import traceback
import uuid

Expand Down Expand Up @@ -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)


Expand Down
14 changes: 13 additions & 1 deletion media/js/zamboni/devhub.js
Expand Up @@ -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){
Expand Down

0 comments on commit 7cd02ca

Please sign in to comment.