version 1.40, 2017/08/21 15:25:55
|
version 1.42, 2018/12/27 18:14:25
|
Line 412 sub invalid_state {
|
Line 412 sub invalid_state {
|
|
|
sub homeserver_redirect { |
sub homeserver_redirect { |
my ($uname,$udom,$domdesc,$brcrum) = @_; |
my ($uname,$udom,$domdesc,$brcrum) = @_; |
my $uhome = &Apache::lonnet::homeserver(); |
my $uhome; |
if ($uhome eq 'no_host') { |
if ($uname ne '') && ($udom ne '')) { |
|
$uhome = &Apache::lonnet::homeserver($uname,$udom); |
|
} |
|
if (($uhome eq 'no_host') || ($uhome eq '')) { |
$uhome = &Apache::lonnet::domain($udom,'primary'); |
$uhome = &Apache::lonnet::domain($udom,'primary'); |
} |
} |
|
my $hostname = &Apache::lonnet::hostname($uhome); |
my $protocol = $Apache::lonnet::protocol{$uhome}; |
my $protocol = $Apache::lonnet::protocol{$uhome}; |
$protocol = 'http' if ($protocol ne 'https'); |
$protocol = 'http' if ($protocol ne 'https'); |
my $url = $protocol.'://'.&Apache::lonnet::hostname($uhome).'/adm/resetpw'; |
my $url = $protocol.'://'.$hostname.'/adm/resetpw'; |
# Breadcrumbs |
# Breadcrumbs |
my $start_page = &Apache::loncommon::start_page('Switching Server',undef, |
my $start_page = &Apache::loncommon::start_page('Switching Server',undef, |
{'redirect' => [0,$url], |
{'redirect' => [0,$url], |
Line 452 sub reset_passwd {
|
Line 456 sub reset_passwd {
|
return; |
return; |
} elsif ($now - $data{'time'} < 7200) { |
} elsif ($now - $data{'time'} < 7200) { |
if ($env{'form.action'} eq 'verify_and_change_pass') { |
if ($env{'form.action'} eq 'verify_and_change_pass') { |
|
$env{'form.uname'} =~ s/^\s+|\s+$//g; |
|
$env{'form.udom'} =~ s/^\s+|\s+$//g; |
|
$env{'form.email'} =~ s/^\s+|\s+$//g; |
unless (($env{'form.uname'} eq $data{'username'}) && ($env{'form.udom'} eq $data{'domain'}) && ($env{'form.email'} eq $data{'email'})) { |
unless (($env{'form.uname'} eq $data{'username'}) && ($env{'form.udom'} eq $data{'domain'}) && ($env{'form.email'} eq $data{'email'})) { |
|
&Apache::lonnet::logthis("Forgot Password -- token data: ||$data{'username'}|| ||$data{'domain'}|| ||$data{'email'}|| differs from form: ||$env{'form.uname'}|| ||$env{'form.udom'}|| ||$env{'form.email'}||"); |
$r->print(&generic_failure_msg($contact_name,$contact_email)); |
$r->print(&generic_failure_msg($contact_name,$contact_email)); |
return; |
return; |
} |
} |
Line 490 sub reset_passwd {
|
Line 498 sub reset_passwd {
|
if ($homeserver eq 'no_host') { |
if ($homeserver eq 'no_host') { |
$r->print(&generic_failure_msg($contact_name,$contact_email)); |
$r->print(&generic_failure_msg($contact_name,$contact_email)); |
} else { |
} else { |
|
my $hostname = &Apache::lonnet::hostname($homeserver); |
my $protocol = $Apache::lonnet::protocol{$homeserver}; |
my $protocol = $Apache::lonnet::protocol{$homeserver}; |
$protocol = 'http' if ($protocol ne 'https'); |
$protocol = 'http' if ($protocol ne 'https'); |
my $url = $protocol.'://'.&Apache::lonnet::hostname($homeserver). |
my $url = $protocol.'://'.$hostname.'/adm/resetpw'; |
'/adm/resetpw'; |
|
my ($opentag,$closetag); |
my ($opentag,$closetag); |
if ($url) { |
if ($url) { |
$opentag = '<a href="'.$url.'">'; |
$opentag = '<a href="'.$url.'">'; |