Allow browser to store new password after change

This commit is contained in:
Julius 2013-12-22 18:26:28 +01:00
parent 3e1d561a5e
commit 53e611c1c0
2 changed files with 10 additions and 1 deletions

View file

@ -35,6 +35,15 @@ $.fn.extend({
// Load following statements, when DOM is ready
$(function() {
// The autocomplete attribute is used for both autocompletion and storing
// for passwords, it's nice to store it when editing one's own profile,
// but never autocomplete.
// This is only implemented for passwords.
$('input[type="password"][autocomplete="off"][data-store="on"]').each(function() {
$(this).on('change', function() {
$(this).removeAttr('autocomplete');
});
});
// Show/Hide a specific DOM element
$(document).on('click', 'a[data-toggle-this]', function() {

View file

@ -6,7 +6,7 @@
-# you can disable password autocompletion by passing `password_autocomplete: false` to this partial
-# see also https://github.com/foodcoops/foodsoft/wiki/Form-autocompletion
- password_autocomplete = nil unless defined?(:password_autocomplete)
- passwd_opts = (password_autocomplete.nil? ? {} : {autocomplete: password_autocomplete ? 'on' : 'off'})
- passwd_opts = (password_autocomplete.nil? ? {} : {autocomplete: password_autocomplete ? 'on' : 'off', data: {store: 'on'}})
= f.input :password, :required => f.object.new_record?, input_html: passwd_opts
= f.input :password_confirmation, :required => f.object.new_record?, input_html: passwd_opts
= f.input :phone