[open-ils-commits] r16234 - branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Apr 14 00:16:48 EDT 2010
Author: dbs
Date: 2010-04-14 00:16:44 -0400 (Wed, 14 Apr 2010)
New Revision: 16234
Modified:
branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
Guard against 0 active requests (which otherwise results in an ugly error)
Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2010-04-14 04:05:52 UTC (rev 16233)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2010-04-14 04:16:44 UTC (rev 16234)
@@ -3422,15 +3422,18 @@
}
});
- my $last_request = DateTime::Format::ISO8601->parse_datetime(clense_ISO8601($active_requests->[0]->{'request_time'}));
- my $now = DateTime::Format::ISO8601->new();
+ # Guard against no active requests
+ if ($active_requests->[0]->{'request_time'}) {
+ my $last_request = DateTime::Format::ISO8601->parse_datetime(clense_ISO8601($active_requests->[0]->{'request_time'}));
+ my $now = DateTime::Format::ISO8601->new();
- # 3. if (num_active > throttle_threshold) and (now - last_request < 1 minute)
- if (($active_requests->[0]->{'usr'} > $aupr_throttle) &&
- ($last_request->add_duration('1 minute') > $now)) {
- $cache->put_cache('open-ils.actor.password.throttle', DateTime::Format::ISO8601->new(), 60);
- $e->die_event;
- return OpenILS::Event->new('PATRON_TOO_MANY_ACTIVE_PASSWORD_RESET_REQUESTS');
+ # 3. if (num_active > throttle_threshold) and (now - last_request < 1 minute)
+ if (($active_requests->[0]->{'usr'} > $aupr_throttle) &&
+ ($last_request->add_duration('1 minute') > $now)) {
+ $cache->put_cache('open-ils.actor.password.throttle', DateTime::Format::ISO8601->new(), 60);
+ $e->die_event;
+ return OpenILS::Event->new('PATRON_TOO_MANY_ACTIVE_PASSWORD_RESET_REQUESTS');
+ }
}
# TODO Check to see if the user is in a password-reset-restricted group
More information about the open-ils-commits
mailing list