Diff for /loncom/interface/createaccount.pm between versions 1.74 and 1.77

version 1.74, 2017/08/03 16:22:08 version 1.77, 2019/05/05 04:00:42
Line 37  use Apache::lonacc; Line 37  use Apache::lonacc;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::loncommon;  use Apache::loncommon;
 use Apache::lonhtmlcommon;  use Apache::lonhtmlcommon;
   use Apache::lonuserutils;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonauth;  use Apache::lonauth;
 use Apache::resetpw;  use Apache::resetpw;
Line 328  sub handler { Line 329  sub handler {
         &print_header($r,$start_page,$courseid,$pagetitle);          &print_header($r,$start_page,$courseid,$pagetitle);
         my $now=time;          my $now=time;
         if ((grep(/^login$/,@{$cancreate})) && (!grep(/^email$/,@{$cancreate}))) {          if ((grep(/^login$/,@{$cancreate})) && (!grep(/^email$/,@{$cancreate}))) {
             if (open(my $jsh,"<$include/londes.js")) {              if (open(my $jsh,"<","$include/londes.js")) {
                 while(my $line = <$jsh>) {                  while(my $line = <$jsh>) {
                     $r->print($line);                      $r->print($line);
                 }                  }
Line 520  ENDSCRIPT Line 521  ENDSCRIPT
 }  }
   
 sub javascript_checkpass {  sub javascript_checkpass {
     my ($now,$context) = @_;      my ($now,$context,$domain) = @_;
     my $nopass = &mt('You must enter a password.');      my $nopass = &mt('You must enter a password.');
     my $mismatchpass = &mt('The passwords you entered did not match.')."\n".      my $mismatchpass = &mt('The passwords you entered did not match.')."\n".
                        &mt('Please try again.');                          &mt('Please try again.'); 
       my ($numrules,$intargjs) =
           &Apache::lonuserutils::passwd_validation_js('upass',$domain);
     &js_escape(\$nopass);      &js_escape(\$nopass);
     &js_escape(\$mismatchpass);      &js_escape(\$mismatchpass);
     my $js = <<"ENDSCRIPT";      my $js = <<"ENDSCRIPT";
Line 540  sub javascript_checkpass { Line 543  sub javascript_checkpass {
                 return false;                  return false;
             }              }
             if (upass == upasscheck) {              if (upass == upasscheck) {
                   var numrules = $numrules;
                   if (numrules > 0) {
   $intargjs
                   }
                 client.elements.upasscheck$now.value='';                  client.elements.upasscheck$now.value='';
                 if (validate_email(client)) {                  if (validate_email(client)) {
                     send(one,two,'$context');                      send(one,two,'$context');
Line 634  sub print_username_form { Line 641  sub print_username_form {
                     push(@posstypes,'default');                      push(@posstypes,'default');
                 }                  }
                 $output .= '<p>'.&mt('Choose your affiliation at [_1]',$domdesc).'</p>'."\n".                  $output .= '<p>'.&mt('Choose your affiliation at [_1]',$domdesc).'</p>'."\n".
                            '<form name="reportstatus" id="LC_reportstatus" action="" method="post" '.                             '<form name="reportstatus" id="LC_reportstatus" action="/adm/createaccount" method="post" '.
                            'onsubmit="return checkVerification();"><p>';                             'onsubmit="return checkVerification();"><p>';
                 foreach my $type (@posstypes) {                  foreach my $type (@posstypes) {
                     my $name;                      my $name;
Line 648  sub print_username_form { Line 655  sub print_username_form {
                             }                              }
                         }                          }
                     }                      }
                     $output .= '<label><input type="radio" name="type" value="'.$type.'" />'.                      my $checked;
                       if ($env{'form.type'} eq $type) {
                           $checked = ' checked="checked"';
                       }
                       $output .= '<label><input type="radio" name="type" value="'.$type.'"'.$checked.' />'.
                                $name.'</label>'.('&nbsp;'x2);                                 $name.'</label>'.('&nbsp;'x2);
                 }                  }
                 if ($env{'form.courseid'} =~ /^$match_domain\_$match_courseid$/) {                  if ($env{'form.courseid'} =~ /^$match_domain\_$match_courseid$/) {
Line 687  sub print_username_form { Line 698  sub print_username_form {
                     }                      }
                     if ($usertype eq '') {                      if ($usertype eq '') {
                         $usertype = 'default';                          $usertype = 'default';
                       } elsif (ref($usertypes) eq 'HASH') {
                           my $usertitle;
                           if ($usertype eq 'default') {
                               $usertitle = $othertitle;
                           } elsif (exists($usertypes->{$usertype})) {
                               $usertitle = $usertypes->{$usertype};
                           }
                           if ($usertitle ne '') {
                               $output .= &mt('Self-reported affiliation: [_1]',
                                              '<span style="font-style: italic;">'.$usertitle.'</span>').
                                          '<br />';
                           }
                     }                      }
                     $output .= &print_dataentry_form($r,$domain,$lonhost,$include,$now,$captchaform,                      $output .= &print_dataentry_form($r,$domain,$lonhost,$include,$now,$captchaform,
                                                      $courseid,$emailusername,$captcha,$usertype,                                                       $courseid,$emailusername,$captcha,$usertype,
Line 1073  sub print_dataentry_form { Line 1096  sub print_dataentry_form {
     my ($r,$domain,$lonhost,$include,$now,$captchaform,$courseid,$emailusername,$captcha,      my ($r,$domain,$lonhost,$include,$now,$captchaform,$courseid,$emailusername,$captcha,
         $usertype,$recaptchaversion,$usernameset,$condition,$excluded) = @_;          $usertype,$recaptchaversion,$usernameset,$condition,$excluded) = @_;
     my ($error,$output);      my ($error,$output);
     if (open(my $jsh,"<$include/londes.js")) {      if (open(my $jsh,"<","$include/londes.js")) {
         while(my $line = <$jsh>) {          while(my $line = <$jsh>) {
             $r->print($line);              $r->print($line);
         }          }
         close($jsh);          close($jsh);
         $output = &javascript_setforms($now,$emailusername,$captcha,$usertype,$recaptchaversion,          $output = &javascript_setforms($now,$emailusername,$captcha,$usertype,$recaptchaversion,
                                        $usernameset,$condition,$excluded).                                         $usernameset,$condition,$excluded).
                   "\n".&javascript_checkpass($now,'email');                    "\n".&javascript_checkpass($now,'email',$domain);
         my ($lkey,$ukey) = &Apache::loncommon::des_keys();          my ($lkey,$ukey) = &Apache::loncommon::des_keys();
         my ($lextkey,$uextkey) = &getkeys($lkey,$ukey);          my ($lextkey,$uextkey) = &getkeys($lkey,$ukey);
         my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount:createaccount',          my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount:createaccount',
Line 1870  sub sso_logout_frag { Line 1893  sub sso_logout_frag {
     if (defined($r->dir_config('lonSSOUserLogoutMessageFile_'.$domain))) {      if (defined($r->dir_config('lonSSOUserLogoutMessageFile_'.$domain))) {
         my $msgfile = $r->dir_config('lonSSOUserLogoutMessageFile_'.$domain);          my $msgfile = $r->dir_config('lonSSOUserLogoutMessageFile_'.$domain);
         if (-e $msgfile) {          if (-e $msgfile) {
             open(my $fh,"<$msgfile");              open(my $fh,"<",$msgfile);
             $endsessionmsg = join('',<$fh>);              $endsessionmsg = join('',<$fh>);
             close($fh);              close($fh);
         }          }
     } elsif (defined($r->dir_config('lonSSOUserLogoutMessageFile'))) {      } elsif (defined($r->dir_config('lonSSOUserLogoutMessageFile'))) {
         my $msgfile = $r->dir_config('lonSSOUserLogoutMessageFile');          my $msgfile = $r->dir_config('lonSSOUserLogoutMessageFile');
         if (-e $msgfile) {               if (-e $msgfile) {     
             open(my $fh,"<$msgfile");              open(my $fh,"<",$msgfile);
             $endsessionmsg = join('',<$fh>);              $endsessionmsg = join('',<$fh>);
             close($fh);              close($fh);
         }          }
Line 1996  function checkVerification() { Line 2019  function checkVerification() {
             if (curr == types[j]) {              if (curr == types[j]) {
                 if (!cancreate) {                  if (!cancreate) {
                     alert('Creation of an account via verification by e-mail unavailable for user type: "'+names[j]+'"');                      alert('Creation of an account via verification by e-mail unavailable for user type: "'+names[j]+'"');
                       setElements();
                 }                  }
                 break;                  break;
             }              }

Removed from v.1.74  
changed lines
  Added in v.1.77


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>