Merge r16568 through r16572 from trunk for fixes to password reset functionality
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Jun 2010 01:37:02 +0000 (01:37 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Jun 2010 01:37:02 +0000 (01:37 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6@16587 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Open-ILS/src/perlmods/OpenILS/WWW/PasswordReset.pm
Open-ILS/web/opac/skin/default/js/password_reset.js

index 0687e28..561aa41 100644 (file)
@@ -3528,8 +3528,9 @@ sub commit_password_reset {
     # Ensure we're still within the TTL for the request
     my $aupr_ttl = $U->ou_ancestor_setting_value($user->home_ou, 'circ.password_reset_request_time_to_live') || 24*60*60;
     my $threshold = DateTime::Format::ISO8601->parse_datetime(clense_ISO8601($aupr->[0]->request_time))->add(seconds => $aupr_ttl);
-    if ($threshold > DateTime->now(time_zone => 'local')) {
+    if ($threshold < DateTime->now(time_zone => 'local')) {
         $e->die_event;
+        $logger->info("Password reset request needed to be submitted before $threshold");
         return OpenILS::Event->new('PATRON_NOT_AN_ACTIVE_PASSWORD_RESET_REQUEST');
     }
 
index 410e7b2..2e3fc2f 100644 (file)
@@ -107,7 +107,6 @@ sub reset_password {
 
     # In case non-matching passwords slip through our funky Web interface
     if ($password_1 and $password_2 and ($password_1 ne $password_2)) {
-        $apache->status(Apache2::Const::DECLINED);
         $ctx->{'status'} = {
             style => 'error',
             msg => $ctx->{'i18n'}{'NO_MATCH'}
@@ -120,7 +119,6 @@ sub reset_password {
     if ($password_1 and $password_2 and ($password_1 eq $password_2)) {
         my $response = $actor->request('open-ils.actor.patron.password_reset.commit', $uuid, $password_1)->gather();
         if (ref($response) && $response->{'textcode'}) {
-            $apache->status(Apache2::Const::DECLINED);
 
             if ($response->{'textcode'} eq 'PATRON_NOT_AN_ACTIVE_PASSWORD_RESET_REQUEST') {
                 $ctx->{'status'} = { 
@@ -175,7 +173,6 @@ sub request_password_reset {
     my $email = $cgi->param('email');
 
     if (!($barcode or $username or $email)) {
-        $apache->status(Apache2::Const::OK);
         $ctx->{'status'} = {
             style => 'plain',
             msg => $ctx->{'i18n'}{'IDENTIFY_YOURSELF'}
@@ -185,7 +182,6 @@ sub request_password_reset {
         return Apache2::Const::OK;
     } elsif ($barcode) {
         my $response = $actor->request('open-ils.actor.patron.password_reset.request', 'barcode', $barcode)->gather();
-        $apache->status(Apache2::Const::OK);
         $ctx->{'status'} = {
             style => 'plain',
             msg => $ctx->{'i18n'}{'REQUEST_SUCCESS'}
@@ -196,7 +192,6 @@ sub request_password_reset {
         return Apache2::Const::OK;
     } elsif ($username) {
         my $response = $actor->request('open-ils.actor.patron.password_reset.request', 'username', $username)->gather();
-        $apache->status(Apache2::Const::OK);
         $ctx->{'status'} = {
             style => 'plain',
             msg => $ctx->{'i18n'}{'REQUEST_SUCCESS'}
index 9da98b4..83db272 100644 (file)
@@ -73,7 +73,8 @@ function createResetDialog() {
     pwResetFormDlg.startup();
 
     // Instantiate the form
-    var pwResetFormDiv = dojo.create("form", { id: "requestReset", style: "width: 30em", method: "post", action: "/opac/password/en-US" });
+    var pwResetFormURL = "/opac/password/" + (OpenSRF.locale || "en-US") + "/";
+    var pwResetFormDiv = dojo.create("form", { id: "requestReset", style: "width: 30em", method: "post", action: pwResetFormURL });
     dojo.create("p", { innerHTML: opac_strings.PWD_RESET_SUBMIT_PROMPT }, pwResetFormDiv);
     var pwResetFormTable = dojo.create("table", null, pwResetFormDiv);
     var pwResetFormTbody = dojo.create("tbody", null, pwResetFormTable);