Allow browser to store new password after change
This commit is contained in:
parent
3e1d561a5e
commit
53e611c1c0
2 changed files with 10 additions and 1 deletions
|
@ -35,6 +35,15 @@ $.fn.extend({
|
||||||
|
|
||||||
// Load following statements, when DOM is ready
|
// Load following statements, when DOM is ready
|
||||||
$(function() {
|
$(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
|
// Show/Hide a specific DOM element
|
||||||
$(document).on('click', 'a[data-toggle-this]', function() {
|
$(document).on('click', 'a[data-toggle-this]', function() {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
-# you can disable password autocompletion by passing `password_autocomplete: false` to this partial
|
-# you can disable password autocompletion by passing `password_autocomplete: false` to this partial
|
||||||
-# see also https://github.com/foodcoops/foodsoft/wiki/Form-autocompletion
|
-# see also https://github.com/foodcoops/foodsoft/wiki/Form-autocompletion
|
||||||
- password_autocomplete = nil unless defined?(:password_autocomplete)
|
- 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, :required => f.object.new_record?, input_html: passwd_opts
|
||||||
= f.input :password_confirmation, :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
|
= f.input :phone
|
||||||
|
|
Loading…
Reference in a new issue