AugustinLF / fernweh

1 stars 0 forks source link

Fix login screen auto-filling #1

Closed AugustinLF closed 9 years ago

AugustinLF commented 9 years ago

Auto-filling should work.


AugustinLF commented 9 years ago

This is a known angular issue and solved with this hack:

#!javascript

  app.directive('formAutofillFix', function() {
  return function(scope, elem, attrs) {
    // Fixes Chrome bug: https://groups.google.com/forum/#!topic/angular/6NlucSskQjY
    elem.prop('method', 'POST');

    // Fix autofill issues where Angular doesn't know about autofilled inputs
    if(attrs.ngSubmit) {
      setTimeout(function() {
        elem.unbind('submit').submit(function(e) {
          e.preventDefault();
          elem.find('input, textarea, select').trigger('input').trigger('change').trigger('keydown');
          scope.$apply(attrs.ngSubmit);
        });
      }, 0);
    }
  };
});

Original comment by: tdotom

AugustinLF commented 9 years ago

See comment


Original comment by: tdotom