| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/Authen.pm,v 1.25 2004/01/03 17:12:55 gage Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/Authen.pm,v 1.26 2004/01/17 17:05:53 gage Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 284 | # so we know this is an expired session. |
284 | # so we know this is an expired session. |
| 285 | $error = "Your session has timed out due to inactivity. You must login again."; |
285 | $error = "Your session has timed out due to inactivity. You must login again."; |
| 286 | last VERIFY; |
286 | last VERIFY; |
| 287 | } |
287 | } |
| 288 | } |
288 | } |
|
|
289 | ######################################################## |
|
|
290 | # Make sure user status is correct |
|
|
291 | ######################################################## |
|
|
292 | my $userRecord = $db->getUser($user); |
|
|
293 | my $userStatus = $userRecord -> status; |
|
|
294 | ######################################################## |
|
|
295 | # for backward compatibility handle the case where status is not defined |
|
|
296 | ######################################################## |
|
|
297 | unless (defined $userStatus) { |
|
|
298 | $userRecord-> status('C'); |
|
|
299 | warn "Setting status for user $user to C. It was previously undefined."; |
| 289 | |
300 | } |
|
|
301 | ######################################################### |
|
|
302 | # Fail with error message if status is D or dropped |
|
|
303 | ######################################################### |
|
|
304 | if ($db->getUser($user)->status eq 'D' or $db->getUser($user)->status eq 'DROPPED') { |
|
|
305 | $error = "The user $user has been dropped from this course. Please contact |
|
|
306 | your instructor if this is an error."; |
|
|
307 | last VERIFY; |
|
|
308 | |
|
|
309 | } |
|
|
310 | ######################################################### |
| 290 | # a password was supplied. |
311 | # a password was supplied. |
|
|
312 | ######################################################### |
| 291 | if ($passwd) { |
313 | if ($passwd) { |
| 292 | # if user has been dropped from the course fail with error message |
314 | |
| 293 | unless ($db->getUser($user)->status eq 'C') { |
|
|
| 294 | $error = "The user $user has been dropped from this course. Please contact |
|
|
| 295 | your instructor if this is an error."; |
|
|
| 296 | last VERIFY; |
|
|
| 297 | |
|
|
| 298 | } |
|
|
| 299 | if ($self->checkPassword($user, $passwd)) { |
315 | if ($self->checkPassword($user, $passwd)) { |
| 300 | # valid password, so create a new session. (we don't want |
316 | # valid password, so create a new session. (we don't want |
| 301 | # to reuse an old one, duh.) |
317 | # to reuse an old one, duh.) |
| 302 | my $Key = $self->generateKey($user); |
318 | my $Key = $self->generateKey($user); |
| 303 | eval { $db->deleteKey($user) }; |
319 | eval { $db->deleteKey($user) }; |