web staff: FF autofil login form support
authorBill Erickson <berick@esilibrary.com>
Tue, 17 Dec 2013 17:48:08 +0000 (12:48 -0500)
committerBill Erickson <berick@esilibrary.com>
Tue, 17 Dec 2013 17:48:08 +0000 (12:48 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/t_login.tt2
Open-ILS/web/js/ui/default/staff/app.js

index a363dfe..a29b7bc 100644 (file)
@@ -11,7 +11,7 @@
             The input IDs are there to match the labels.  
             They are not referenced in the Login controller.
           -->
-          <form ng-submit="login(args)">
+          <form ng-submit="login(args)" name="login-form">
             <div class="form-group row">
               <label class="col-md-4 control-label" for="login-username">[% l('Username') %]</label>
               <div class="col-md-8">
index 2b4fba5..c5acf5f 100644 (file)
@@ -56,7 +56,22 @@ angular.module('egHome', ['ngRoute', 'ui.bootstrap', 'egCoreMod', 'egUiMod'])
             args.type = 'staff';
             $scope.loginFailed = false;
 
+            if (!args.username) {
+                /* 
+                 Issues with form autofill / auto-complete                          
+                 https://github.com/angular/angular.js/issues/1460                  
+                 http://timothy.userapp.io/post/63412334209/form-autocomplete-and-remember-password-with-angularjs
+                 For now, since FF will save the values, we should 
+                 honor them, even if it's hacky. */
+                args.username = document.getElementById("login-username").value;
+                args.password = document.getElementById("login-password").value;
+                args.workstation = document.getElementById("login-workstation").value;
+            }
+
+            if (! (args.username && args.password) ) return;
+
             egAuth.login(args).then(
+
                 function() { 
                     // after login, send the user back to the originally
                     // requested page or, if none, the home page.