s.CHECK_IN_CONFIRM = "[% l('Check In Items?') %]";
s.REG_INVALID_FIELDS =
"[% l('Please enter valid values for all required fields.') %]"
+ s.REG_PASSWORD_RESET_REQUEST_NO_EMAIL =
+ "[% l('An email address is required for a password reset link to be sent.') %]";
+ s.REG_PASSWORD_RESET_REQUEST_DIFFERENT_EMAIL =
+ "[% l('Patron email address appears to have been changed but not yet saved. Please save user before attempting to send password reset link.') %]";
+ s.REG_PASSWORD_RESET_REQUEST_SUCCESSFUL =
+ "[% l('Submitted request for password reset link to be sent via email.') %]";
s.PAYMENT_WARN_AMOUNT = "[% l('Are you sure you want to apply a payment of $[_1]?', '{{payment_amount}}') %]";
s.PAYMENT_WARN_AMOUNT_TITLE = "[% l('Verify Payment Amount') %]";
s.PAYMENT_OVER_MAX = "[% l('Payments over $[_1] are denied by policy.', '{{max_amount}}') %]";
egCore.auth.token(), usrname);
}
+ // compare string with email address of loaded user, return true if different
+ service.check_email_different = function(email) {
+ if (service.existing_patron) {
+ if (email != service.existing_patron.email()) {
+ return $q.when(true);
+ }
+ }
+ }
+
//service.check_grp_app_perm = function(grp_id) {
// determine which user groups our user is not allowed to modify
.controller('PatronRegCtrl',
['$scope','$routeParams','$q','$uibModal','$window','egCore',
'patronSvc','patronRegSvc','egUnloadPrompt','egAlertDialog',
- 'egWorkLog', '$timeout','ngToast',
+ 'egWorkLog', '$timeout', 'ngToast',
function($scope , $routeParams , $q , $uibModal , $window , egCore ,
patronSvc , patronRegSvc , egUnloadPrompt, egAlertDialog ,
egWorkLog, $timeout, ngToast) {
$scope.patron.passwd = Math.floor(Math.random()*9000) + 1000;
}
+ $scope.send_password_reset_link = function() {
+ if (!$scope.patron.email || $scope.patron.email == '') {
+ egAlertDialog.open(egCore.strings.REG_PASSWORD_RESET_REQUEST_NO_EMAIL);
+ return;
+ } else if (patronRegSvc.check_email_different($scope.patron.email)) {
+ egAlertDialog.open(egCore.strings.REG_PASSWORD_RESET_REQUEST_DIFFERENT_EMAIL);
+ return;
+ }
+ // we have an email address, fire the reset request
+ egCore.net.request(
+ 'open-ils.actor',
+ 'open-ils.actor.patron.password_reset.request',
+ 'barcode', $scope.patron.card.barcode, $scope.patron.email
+ ).then(function(resp) {
+ if (resp == '1') { // request okay
+ ngToast.success(egCore.strings.REG_PASSWORD_RESET_REQUEST_SUCCESSFUL);
+ } else {
+ var evt = egCore.evt.parse(resp);
+ egAlertDialog.open(evt.desc);
+ }
+ });
+ }
+
$scope.set_expire_date = function() {
if (!$scope.patron.profile) return;
var seconds = egCore.date.intervalToSeconds(