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

version 1.77, 2019/05/05 04:00:42 version 1.78, 2019/05/05 23:19:47
Line 842  sub process_email_request { Line 842  sub process_email_request {
             } else {              } else {
                 my ($captcha_chk,$captcha_error) = &Apache::loncommon::captcha_response('usercreation',$server);                  my ($captcha_chk,$captcha_error) = &Apache::loncommon::captcha_response('usercreation',$server);
                 if ($captcha_chk != 1) {                  if ($captcha_chk != 1) {
                     $output = &invalid_state('captcha',$domdesc,$contact_name,                      $output = '<span class="LC_warning">'.
                                              $contact_email,$captcha_error);                                &mt('Validation of the code you entered failed.').'</span>'.
                                 '<br />'.$captcha_error."\n".'<br /><p>'.
                                  &mt('[_1]Return[_2] to the previous page to try again.',
                                      '<a href="javascript:document.retryemail.submit();">','</a>')."\n".
                                 '<form name="retryemail" action="/adm/createaccount" method="post" />'.
                                 '<input type="hidden" name="domain" value="'.$domain.'" />'."\n";
                       if ($env{'form.courseid'} =~ /^$match_domain\_$match_courseid$/) {
                           $output .= '<input type="hidden" name="courseid" value="'.$env{'form.courseid'}.'" />'."\n";
                       }
                       if ($env{'form.type'}) {
                           my $usertype = &get_usertype($domain);
                           if ($usertype ne '') {
                               $output .= '<input type="hidden" name="type" value="'.$usertype.'" />'."\n".
                                          '<input type="hidden" name="reportedtype" value="'.&mt('Submit').'" />'."\n";
                           }
                       }
                       $output .= '</form></p>';
                     return $output;                      return $output;
                 }                  }
                 my (%rulematch,%inst_results,%curr_rules,%got_rules,%alerts);                  my (%rulematch,%inst_results,%curr_rules,%got_rules,%alerts);
Line 901  sub send_token { Line 917  sub send_token {
     $env{'form.logtoken'} =~ s/(`)//g;      $env{'form.logtoken'} =~ s/(`)//g;
     if ($env{'form.logtoken'}) {      if ($env{'form.logtoken'}) {
         my $logtoken = $env{'form.logtoken'};          my $logtoken = $env{'form.logtoken'};
           my $earlyout;
         my $tmpinfo=Apache::lonnet::reply('tmpget:'.$logtoken,$server);          my $tmpinfo=Apache::lonnet::reply('tmpget:'.$logtoken,$server);
         if (($tmpinfo=~/^error/) || ($tmpinfo eq 'con_lost')) {          if (($tmpinfo=~/^error/) || ($tmpinfo eq 'con_lost')) {
             $msg = &mt('Information needed to process your request is missing, inaccessible or expired.')              $msg = &mt('Information needed to process your request is missing, inaccessible or expired.')
                   .'<br />'.&mt('Return to the previous page to try again.');                    .'<br /><p>'.&mt('[_1]Return[_2] to the previous page to try again.',
                                      '<a href="javascript:document.retryemail.submit();">','</a>');
               $earlyout = 1;
         } else {          } else {
             my $reply = &Apache::lonnet::reply('tmpdel:'.$logtoken,$server);              my $reply = &Apache::lonnet::reply('tmpdel:'.$logtoken,$server);
             unless ($reply eq 'ok') {              unless ($reply eq 'ok') {
                 $msg .= &mt('Request could not be processed.');                  $msg .= &mt('Request could not be processed.');
             }              }
         }          }
   # Check if the password entered by the user satisfies domain's requirements
           my %passwdconf = &Apache::lonnet::get_passwdconf($domain);
           my ($min,$max,@chars);
           if (ref($passwdconf{'chars'}) eq 'ARRAY') {
               if ($passwdconf{'min'} =~ /^\d+$/) {
                   $min = $passwdconf{'min'};
               }
               if ($passwdconf{'max'} =~ /^\d+$/) {
                   $max = $passwdconf{'max'};
               }
               @chars = @{$passwdconf{'chars'}};
           } else {
               $min = 7;
           }
           if (($min ne '') || ($max ne '') || (@chars > 0)) {
               my ($plainpass,$encpass);
               my $encpass = $env{'form.upass'};
               if ($encpass eq '') {
                   $msg = &mt('Password retrieved was blank.').
                          '<br /><p>'.&mt('[_1]Return[_2] to the previous page to try again.',
                                          '<a href="javascript:document.retryemail.submit();">','</a>');
                   $earlyout = 1;
               } else {
   # Split the logtoken to retrieve the DES key and decrypt the encypted password
                   my ($key,$caller)=split(/&/,$tmpinfo);
                   if ($caller eq 'createaccount') {
                       $plainpass = &Apache::loncommon::des_decrypt($key,$encpass);
                       my $warning = &Apache::loncommon::check_passwd_rules($domain,$plainpass);
                       if ($warning) {
                           $msg = $warning.
                                  '<p>'.&mt('[_1]Return[_2] to the previous page to try again.',
                                            '<a href="javascript:document.retryemail.submit();">','</a>');
                           $earlyout = 1;
                       }
                   }
               }
           }
           if ($earlyout) {
               $msg .= '<form name="retryemail" action="/adm/createaccount" method="post" />'.
                       '<input type="hidden" name="domain" value="'.$domain.'" />'."\n";
               if ($env{'form.courseid'} =~ /^$match_domain\_$match_courseid$/) {
                   $msg .= '<input type="hidden" name="courseid" value="'.$env{'form.courseid'}.'" />'."\n";
               }
               if ($env{'form.type'}) {
                   my $usertype = &get_usertype($domain);
                   if ($usertype ne '') {
                       $msg .= '<input type="hidden" name="type" value="'.$usertype.'" />'.
                               '<input type="hidden" name="reportedtype" value="'.&mt('Submit').'" />'."\n";
                   }
               }
               $msg .= '</form></p>';
               return $msg;
           }
         my %info = ('ip'         => $ENV{'REMOTE_ADDR'},          my %info = ('ip'         => $ENV{'REMOTE_ADDR'},
                     'time'       => $now,                      'time'       => $now,
                     'domain'     => $domain,                      'domain'     => $domain,
Line 1711  sub invalid_state { Line 1783  sub invalid_state {
         $msg .= &mt('Username rules at this institution do not allow the e-mail address you provided to be used as a username.');          $msg .= &mt('Username rules at this institution do not allow the e-mail address you provided to be used as a username.');
     } elsif ($error eq 'userformat') {      } elsif ($error eq 'userformat') {
         $msg .= &mt('The e-mail address you provided may not be used as a username at this LON-CAPA institution.');          $msg .= &mt('The e-mail address you provided may not be used as a username at this LON-CAPA institution.');
     } elsif ($error eq 'captcha') {  
         $msg .= &mt('Validation of the code you entered failed.');  
     } elsif ($error eq 'noemails') {      } elsif ($error eq 'noemails') {
         $msg .= &mt('Creation of a new user account using an e-mail address as username is not permitted at this LON-CAPA institution.');          $msg .= &mt('Creation of a new user account using an e-mail address as username is not permitted at this LON-CAPA institution.');
     } elsif ($error eq 'emailfail') {      } elsif ($error eq 'emailfail') {

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


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