[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonsupportreq.pm

raeburn raeburn at source.lon-capa.org
Fri Aug 12 14:23:32 EDT 2016


raeburn		Fri Aug 12 18:23:32 2016 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonsupportreq.pm 
  Log:
  - For 2.11
    - Backport 1.82
  
  
Index: loncom/interface/lonsupportreq.pm
diff -u loncom/interface/lonsupportreq.pm:1.79 loncom/interface/lonsupportreq.pm:1.79.2.1
--- loncom/interface/lonsupportreq.pm:1.79	Tue Jun  9 21:22:57 2015
+++ loncom/interface/lonsupportreq.pm	Fri Aug 12 18:23:32 2016
@@ -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 @@
     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 @@
             }
         }
     }
+    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 @@
 // ]]>
 </script>
 ENDJS
+    if ($recaptcha_version >=2) {
+        $js.= "\n".'<script src="https://www.google.com/recaptcha/api.js"></script>'."\n";
+    }
     my %add_entries = (
                        style    => "margin-top:0px;margin-bottom:0px;",
                        onload   => "initialize_codes();",
@@ -329,7 +341,7 @@
                &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]).
                        '<input type="text" size="50" name="cc" value="" /><br />'."\n".
@@ -343,8 +355,7 @@
                      &HTML::Entities::encode($udom,'"<>&').'" />'."\n";
     my $uname_input = '<input type="hidden" name="uname" value="'.
                       &HTML::Entities::encode($uname,'"<>&').'" />'."\n"; 
-    if (($env{'user.name'} =~ /^$match_username$/) && 
-        ($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) {
+    if ($knownuser) {
         $output .= '<i>'.$html_lt{'unme'}.'</i>: '.$uname.'  <i>'.$html_lt{'doma'}.'</i>: '.$udom.$udom_input.$uname_input;
     } else {
         my $udomform = '';
@@ -504,7 +515,7 @@
                &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]).
                        ' <input type="file" name="screenshot" size="20" /><br />'.
@@ -514,16 +525,13 @@
             $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(
                            '<span title="'.&mt('required').'">'.
                            &mt('Validation').
                            ' <span class="LC_info">*</span></span>'
                       ,undef,$css[$i]).
-                       $captchaform."\n".
+                       $captcha_form."\n".
                        &Apache::lonhtmlcommon::row_closure();
             $num ++;
             $i = $num%2;




More information about the LON-CAPA-cvs mailing list