--- loncom/interface/lonsupportreq.pm 2015/06/23 02:42:34 1.81 +++ loncom/interface/lonsupportreq.pm 2016/02/19 02:39:07 1.82 @@ -1,5 +1,5 @@ # -# $Id: lonsupportreq.pm,v 1.81 2015/06/23 02:42:34 musolffc Exp $ +# $Id: lonsupportreq.pm,v 1.82 2016/02/19 02:39:07 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -82,7 +82,8 @@ sub print_request_form { my ($r,$origurl,$function) = @_; my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid, $cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server, - $formname,$public,$homeserver); + $formname,$public,$homeserver,$knownuser,$captcha_form,$captcha_error, + $captcha,$recaptcha_version); $function = &Apache::loncommon::get_users_function() if (!$function); $ccode = ''; $os = $env{'browser.os'}; @@ -103,6 +104,14 @@ sub print_request_form { } } } + if (($env{'user.name'} =~ /^$match_username$/) && + ($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { + $knownuser = 1; + } else { + my $lonhost = $r->dir_config('lonHostID'); + ($captcha_form,$captcha_error,$captcha,$recaptcha_version) = + &Apache::loncommon::captcha_display('login',$lonhost); + } if ($homeserver) { $uhome = $env{'user.home'}; $urole = $env{'request.role'}; @@ -275,6 +284,9 @@ $loaditems ENDJS + if ($recaptcha_version >=2) { + $js.= "\n".''."\n"; + } my %add_entries = ( style => "margin-top:0px;margin-bottom:0px;", onload => "initialize_codes();", @@ -328,8 +340,8 @@ ENDJS &Apache::lonhtmlcommon::row_closure(); $num ++; $i = $num%2; - if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { - if ($homeserver) { + if ($knownuser) { + if ($homeserver) { $output .= &Apache::lonhtmlcommon::row_title($html_lt{'emac'},undef,$css[$i]). '
'."\n". &Apache::lonhtmlcommon::row_closure(); @@ -342,8 +354,7 @@ ENDJS &HTML::Entities::encode($udom,'"<>&').'" />'."\n"; my $uname_input = '&').'" />'."\n"; - if (($env{'user.name'} =~ /^$match_username$/) && - ($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { + if ($knownuser) { $output .= ''.$html_lt{'unme'}.': '.$uname.'  '.$html_lt{'doma'}.': '.$udom.$udom_input.$uname_input; } else { my $udomform = ''; @@ -503,7 +514,7 @@ ENDJS &Apache::lonhtmlcommon::row_closure(); $num ++; $i = $num%2; - if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { + if ($knownuser) { if ($homeserver) { $output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i]) .' ' @@ -514,16 +525,13 @@ ENDJS $i = $num%2; } } else { - my $lonhost = $r->dir_config('lonHostID'); - my ($captchaform,$error) = - &Apache::loncommon::captcha_display('login',$lonhost); - if ($captchaform) { + if ($captcha_form) { $output .= &Apache::lonhtmlcommon::row_title( ''. &mt('Validation'). ' *' ,undef,$css[$i]). - $captchaform."\n". + $captcha_form."\n". &Apache::lonhtmlcommon::row_closure(); $num ++; $i = $num%2;