From: Bill Erickson Date: Mon, 12 May 2014 18:22:37 +0000 (-0400) Subject: integrate creds check UI into patron app.. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2ed32c163ab65619d00b140b53ddc983ca8d4158;p=working%2FEvergreen.git integrate creds check UI into patron app.. to better support the patron-specific Test Password feature, which uses the same UI. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/staff/circ/patron/creds/index.tt2 b/Open-ILS/src/templates/staff/circ/patron/creds/index.tt2 deleted file mode 100644 index d211ed7fc4..0000000000 --- a/Open-ILS/src/templates/staff/circ/patron/creds/index.tt2 +++ /dev/null @@ -1,79 +0,0 @@ -[% - WRAPPER "staff/base.tt2"; - ctx.page_title = l("Verify Patron Credentials"); - ctx.page_app = "egPatronCredsApp"; -%] - -[% BLOCK APP_JS %] - - - - -[% END %] - - -
-
-
-
- [% l('Verify Credentials') %] -
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
-
- -
-
- -
-
- -
-
-
- [% l('Succes testing credentials') %] -
-
- [% l('Failure testing credentials') %] -
-
- [% l('No user found with the requested username / barcode') %] -
-
-
- -
-
-
-
-
-[% END %] diff --git a/Open-ILS/src/templates/staff/circ/patron/index.tt2 b/Open-ILS/src/templates/staff/circ/patron/index.tt2 index f3f80cae4a..9f7acdf6ad 100644 --- a/Open-ILS/src/templates/staff/circ/patron/index.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/index.tt2 @@ -11,6 +11,9 @@ + + + diff --git a/Open-ILS/src/templates/staff/circ/patron/t_credentials.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_credentials.tt2 new file mode 100644 index 0000000000..46f6e046b2 --- /dev/null +++ b/Open-ILS/src/templates/staff/circ/patron/t_credentials.tt2 @@ -0,0 +1,64 @@ +
+
+
+
+ [% l('Verify Credentials') %] +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ [% l('Succes testing credentials') %] +
+
+ [% l('Failure testing credentials') %] +
+
+ [% l('No user found with the requested username / barcode') %] +
+
+
+ +
+
+
+
+
diff --git a/Open-ILS/src/templates/staff/navbar.tt2 b/Open-ILS/src/templates/staff/navbar.tt2 index 13ff1ca2c4..c2de8b846d 100644 --- a/Open-ILS/src/templates/staff/navbar.tt2 +++ b/Open-ILS/src/templates/staff/navbar.tt2 @@ -69,7 +69,7 @@
  • - + [% l('Verify Credentials') %] diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js index 394bc2664c..61f938a887 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js @@ -56,6 +56,11 @@ angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap', resolve : resolver }); + $routeProvider.when('/circ/patron/credentials', { + templateUrl: './circ/patron/t_credentials', + controller: 'PatronVerifyCredentialsCtrl', + resolve : resolver + }); $routeProvider.when('/circ/patron/:id/checkout', { templateUrl: './circ/patron/t_checkout', @@ -588,3 +593,74 @@ function($scope, $routeParams, egCore) { $scope.initTab('edit', $routeParams.id); }]) +/** + * Credentials tester + */ +.controller('PatronVerifyCredentialsCtrl', + ['$scope','$location','egCore', +function($scope, $location , egCore) { + $scope.verified = null; + $scope.focusMe = true; + + // verify login credentials + $scope.verify = function() { + $scope.verified = null; + $scope.notFound = false; + + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.verify_user_password', + egCore.auth.token(), + $scope.barcode, + $scope.username, + hex_md5($scope.password || '') + ).then(function(resp) { + $scope.focusMe = true; + if (evt = egCore.evt.parse(resp)) { + alert(evt); + } else if (resp == 1) { + $scope.verified = true; + } else { + $scope.verified = false; + } + }); + } + + // load the main patron UI for the provided username or barcode + $scope.load = function($event) { + $scope.notFound = false; + $scope.verified = null; + + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.user.retrieve_id_by_barcode_or_username', + egCore.auth.token(), + $scope.barcode, + $scope.username + ).then(function(resp) { + + if (Number(resp)) { + $location.path('/circ/patron/' + resp + '/checkout'); + return; + } + + // something went wrong... + $scope.focusMe = true; + if (evt = egCore.evt.parse(resp)) { + if (evt.textcode == 'ACTOR_USR_NOT_FOUND') { + $scope.notFound = true; + return; + } + return alert(evt); + } else { + alert(resp); + } + }); + + // load() button sits within the verify form. + // avoid submitting the verify() form action on load() + $event.preventDefault(); + } +}]) + + diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/creds/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/creds/app.js deleted file mode 100644 index 9ef6ffe659..0000000000 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/creds/app.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Patron Credentials App - */ - -angular.module('egPatronCredsApp', ['ngRoute', 'egCoreMod', 'egUiMod']) - -.config(function($locationProvider, $compileProvider) { - $locationProvider.html5Mode(true); - $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|blob):/); // grid export -}) - - -/** - * Manages edit - */ -.controller('PatronVerifyCredentialsCtrl', - ['$scope','$window','egCore', -function($scope, $window , egCore) { - $scope.verified = null; - $scope.focusMe = true; - - // standalone controller w/ no resolver; load startup manually - egCore.startup.go(); - - // verify login credentials - $scope.verify = function() { - $scope.verified = null; - $scope.notFound = false; - - egCore.net.request( - 'open-ils.actor', - 'open-ils.actor.verify_user_password', - egCore.auth.token(), - $scope.barcode, - $scope.username, - hex_md5($scope.password || '') - ).then(function(resp) { - $scope.focusMe = true; - console.debug('verify replied ' + resp); - if (evt = egCore.evt.parse(resp)) { - alert(evt); - } else if (resp == 1) { - $scope.verified = true; - } else { - $scope.verified = false; - } - }); - } - - // load the main patron UI for the provided username or barcode - $scope.load = function($event) { - $scope.notFound = false; - $scope.verified = null; - - egCore.net.request( - 'open-ils.actor', - 'open-ils.actor.user.retrieve_id_by_barcode_or_username', - egCore.auth.token(), - $scope.barcode, - $scope.username - ).then(function(resp) { - if (Number(resp)) { - $window.location.href = - $window.location.href - .replace(/creds.*/,resp + '/checkout'); - return; - } - - // something went wrong... - $scope.focusMe = true; - if (evt = egCore.evt.parse(resp)) { - if (evt.textcode == 'ACTOR_USR_NOT_FOUND') { - $scope.notFound = true; - return; - } - return alert(evt); - } else { - alert(resp); - } - }); - - // load() button sits within the verify form. - // avoid submitting the verify() form action on load() - $event.preventDefault(); - } -}]) -