--- loncom/interface/lonsupportreq.pm 2015/06/09 21:22:57 1.79 +++ loncom/interface/lonsupportreq.pm 2016/08/12 18:23:32 1.79.2.1 @@ -1,5 +1,5 @@ # -# $Id: lonsupportreq.pm,v 1.79 2015/06/09 21:22:57 damieng Exp $ +# $Id: lonsupportreq.pm,v 1.79.2.1 2016/08/12 18:23:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -84,7 +84,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'}; @@ -105,6 +106,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'}; @@ -276,6 +285,9 @@ $loaditems // ]]> ENDJS + if ($recaptcha_version >=2) { + $js.= "\n".''."\n"; + } my %add_entries = ( style => "margin-top:0px;margin-bottom:0px;", onload => "initialize_codes();", @@ -329,7 +341,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{'emac'},undef,$css[$i]). '
'."\n". @@ -343,8 +355,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 = ''; @@ -504,7 +515,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;