[LON-CAPA-cvs] cvs: loncom /interface createaccount.pm

raeburn raeburn at source.lon-capa.org
Thu Jun 19 19:36:54 EDT 2014


raeburn		Thu Jun 19 23:36:54 2014 EDT

  Modified files:              
    /loncom/interface	createaccount.pm 
  Log:
  - Where self-creation of accounts is enabled for institutional log-in and
    also e-mail address as username, call to &javascript_setforms() needs to
    occur from within print_dataentry_form() so that args required for CAPTCHA
    validation are passed (when ReCAPTCHA or CAPTCHA are in use).
  
  
Index: loncom/interface/createaccount.pm
diff -u loncom/interface/createaccount.pm:1.67 loncom/interface/createaccount.pm:1.68
--- loncom/interface/createaccount.pm:1.67	Fri May 30 16:46:03 2014
+++ loncom/interface/createaccount.pm	Thu Jun 19 23:36:54 2014
@@ -4,7 +4,7 @@
 # kerberos, or SSO) or an e-mail address. Requests to use an e-mail address as
 # username may be processed automatically, or may be queued for approval.
 #
-# $Id: createaccount.pm,v 1.67 2014/05/30 16:46:03 raeburn Exp $
+# $Id: createaccount.pm,v 1.68 2014/06/19 23:36:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -277,15 +277,13 @@
     } elsif (!$token) {
         &print_header($r,$start_page,$courseid);
         my $now=time;
-        my $gotlondes;
-        if (grep(/^login$/,@{$cancreate})) {
+        if ((grep(/^login$/,@{$cancreate})) && (!grep(/^email$/,@{$cancreate}))) {
             if (open(my $jsh,"<$include/londes.js")) {
                 while(my $line = <$jsh>) {
                     $r->print($line);
                 }
                 close($jsh);
                 $r->print(&javascript_setforms($now));
-                $gotlondes = 1;
             }
         }
         if (grep(/^email$/,@{$cancreate})) {
@@ -293,8 +291,7 @@
         }
         my $usertype = &get_usertype($domain);
         $output = &print_username_form($r,$domain,$domdesc,$cancreate,$now,$lonhost,
-                                       $include,$courseid,$gotlondes,$emailusername,
-                                       $usertype);
+                                       $include,$courseid,$emailusername,$usertype);
     }
     $r->print($output);
     &print_footer($r);
@@ -512,7 +509,7 @@
 }
 
 sub print_username_form {
-    my ($r,$domain,$domdesc,$cancreate,$now,$lonhost,$include,$courseid,$gotlondes,$emailusername,
+    my ($r,$domain,$domdesc,$cancreate,$now,$lonhost,$include,$courseid,$emailusername,
         $usertype) = @_;
     my %lt = &Apache::lonlocal::texthash (
                                          unam => 'username',
@@ -571,8 +568,7 @@
                                $lt{'yopw'}.'<br />';
                 }
                 $output .= &print_dataentry_form($r,$domain,$lonhost,$include,$now,$captchaform,
-                                                 $courseid,$gotlondes,$emailusername,$captcha,
-                                                 $usertype);
+                                                 $courseid,$emailusername,$captcha,$usertype);
             }
             $output .= '</div>';
         }
@@ -885,21 +881,16 @@
 # Stores token to store DES-key and stage during creation session
 #
 sub print_dataentry_form {
-    my ($r,$domain,$lonhost,$include,$now,$captchaform,$courseid,$gotlondes,$emailusername,$captcha,
+    my ($r,$domain,$lonhost,$include,$now,$captchaform,$courseid,$emailusername,$captcha,
         $usertype) = @_;
     my ($error,$output);
-    unless ($gotlondes) {
-        if (open(my $jsh,"<$include/londes.js")) {
-            while(my $line = <$jsh>) {
-                $r->print($line);
-            }
-            close($jsh);
-            $output = &javascript_setforms($now,$emailusername,$captcha,$usertype)."\n";
-            $gotlondes = 1;
-        }
-    }
-    if ($gotlondes) {
-        $output .= &javascript_checkpass($now,'email');
+    if (open(my $jsh,"<$include/londes.js")) {
+        while(my $line = <$jsh>) {
+            $r->print($line);
+        }
+        close($jsh);
+        $output = &javascript_setforms($now,$emailusername,$captcha,$usertype)."\n".
+                  &javascript_checkpass($now,'email');
         my ($lkey,$ukey) = &Apache::loncommon::des_keys();
         my ($lextkey,$uextkey) = &getkeys($lkey,$ukey);
         my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount:createaccount',




More information about the LON-CAPA-cvs mailing list