version 1.17.10.3, 2009/11/19 16:08:25
|
version 1.21, 2009/10/08 22:59:18
|
Line 31
|
Line 31
|
|
|
=head1 NAME |
=head1 NAME |
|
|
Apache::resetpw: reset user password. |
Apache::resetpw - pile of common routines |
|
|
=head1 SYNOPSIS |
=head1 SYNOPSIS |
|
|
Line 39 Handles resetting of forgotten passwords
|
Line 39 Handles resetting of forgotten passwords
|
|
|
This is part of the LearningOnline Network with CAPA project |
This is part of the LearningOnline Network with CAPA project |
described at http://www.lon-capa.org. |
described at http://www.lon-capa.org. |
|
|
=head1 OVERVIEW |
=head1 OVERVIEW |
|
|
A user with an e-mail address associated with his/her LON-CAPA username |
A user with an e-mail address associated with his/her LON-CAPA username |
can reset a forgotten password, using a link sent to the e-mail address |
can reset a forgotten password, using a link sent to the e-mail address |
if the authentication type for the account is "internal". |
if the authentication type for the account is "internal". |
|
account is "internal". |
|
|
=cut |
=cut |
|
|
Line 109 sub handler {
|
Line 110 sub handler {
|
} |
} |
foreach my $item (@items) { |
foreach my $item (@items) { |
if ($item =~ /^[^\@]+\@[^\@]+\.[^\@\.]+$/) { |
if ($item =~ /^[^\@]+\@[^\@]+\.[^\@\.]+$/) { |
unless(grep(/^\Q$item\E$/,@allemails)) { |
unless(grep(/^\Q$item\E$/,@allemails)) { |
push(@allemails,$item); |
push(@allemails,$item); |
} |
} |
} |
} |
Line 148 sub handler {
|
Line 149 sub handler {
|
sub get_uname { |
sub get_uname { |
my ($defdom) = @_; |
my ($defdom) = @_; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
unam => 'LON-CAPA username', |
unam => 'username', |
udom => 'LON-CAPA domain', |
udom => 'domain', |
uemail => 'E-mail address in LON-CAPA', |
uemail => 'E-mail address in LON-CAPA', |
proc => 'Proceed'); |
proc => 'Proceed'); |
|
|
Line 163 sub get_uname {
|
Line 164 sub get_uname {
|
<form name="forgotpw" method="post"> |
<form name="forgotpw" method="post"> |
<table> |
<table> |
<tr><td> |
<tr><td> |
<tr><td align="left">$lt{'unam'}:</td> |
<tr><td align="left">LON-CAPA $lt{'unam'}: </td> |
<td><input type="text" name="uname" size="15" /></td></tr> |
<td><input type="text" name="uname" size="15" /></td></tr> |
<tr><td align="left">$lt{'udom'}:</td> |
<tr><td align="left">LON-CAPA $lt{'udom'}: </td> |
<td>|; |
<td>|; |
$msg .= &Apache::loncommon::select_dom_form($defdom,'udom'); |
$msg .= &Apache::loncommon::select_dom_form($defdom,'udom'); |
$msg .= qq|</td></tr> |
$msg .= qq|</td></tr> |
Line 276 sub reset_passwd {
|
Line 277 sub reset_passwd {
|
my $reqtime = &Apache::lonlocal::locallocaltime($data{'time'}); |
my $reqtime = &Apache::lonlocal::locallocaltime($data{'time'}); |
if ($now - $data{'time'} < 7200) { |
if ($now - $data{'time'} < 7200) { |
if ($env{'form.action'} eq 'verify_and_change_pass') { |
if ($env{'form.action'} eq 'verify_and_change_pass') { |
unless (($env{'form.uname'} eq $data{'username'}) && ($env{'form.udom'} eq $data{'domain'}) && ($env{'form.email'} eq $data{'email'})) { |
|
$msg = &generic_failure_msg($contact_name,$contact_email); |
|
return $msg; |
|
} |
|
my $change_failed = |
my $change_failed = |
&Apache::lonpreferences::verify_and_change_password($r,'reset_by_email',$token); |
&Apache::lonpreferences::verify_and_change_password($r,'reset_by_email',$token); |
if (!$change_failed) { |
if (!$change_failed) { |