2

I'm developping an angularjs (v1.2.26) application. And I used KeePass (v2.28), chromeIPass 2.6.8 (google chrome extension) to fill credentials.

I got an issue with the login form: Keepass allow to auto complete (mandatory) username and password fields.

In this case, angularjs dosn't detect the value and consider the form as invalid (I can't connect). enter image description here

I try a little workaround under but this seems not work each time. Any idea on how to solve this ?


workaround used in ng-controller (doesn't work each time):

$scope.focusLogin = function() {
  // try to avoid 'form invalid' state when browser auto-complete form fields
  $('#LoginView_Password').focus();
  $('#LoginView_Password').change();
  $('#LoginView_Password').focus();
  $('#LoginView_Username').focus();
  $('#LoginView_Username').change();
  $('#LoginView_Username').focus();
};
setTimeout($scope.focusLogin, 500);
boly38
  • 1,806
  • 24
  • 29

1 Answers1

0

Since I switch to Auth0 mechanism, I do not have this login form anymore.

Anyway, I had found this little workaround using 'trigger' (to put into the login controller). Example that check every second if third party (ex. keepass plugin) fill the form :

  $scope.needLogin = true;
  $scope.focusLogin = function() {
    // avoid 'form invalid' state when browser auto-complete form fields
    $('#LoginView_Username').trigger('input');
    $('#LoginView_Password').trigger('input');
    if (!$scope.loginForm.$invalid) {
      // commonService.info('ok, click on login button');
      $scope.needLogin = false;
    }
    if (!$scope.needLogin) {
      return;
    }
    setTimeout($scope.focusLogin, 1000);
  };
boly38
  • 1,806
  • 24
  • 29