Diff for /loncom/interface/createaccount.pm between versions 1.27 and 1.28

version 1.27, 2009/01/14 13:13:59 version 1.28, 2009/02/07 00:59:17
Line 404  sub print_username_form { Line 404  sub print_username_form {
         }          }
         if (grep(/^email$/,@{$cancreate})) {          if (grep(/^email$/,@{$cancreate})) {
             $output .= '<div class="LC_left_float"><h3>'.&mt('Create account with an e-mail address as your username').'</h3>';              $output .= '<div class="LC_left_float"><h3>'.&mt('Create account with an e-mail address as your username').'</h3>';
             if (grep(/^login$/,@{$cancreate})) {  
                 $output .= &mt('Provide your e-mail address to request a LON-CAPA account,[_1] if you do not have a log-in ID at your institution.','<br />').'<br /><br />';  
             } else {  
                 $output .= '<br />';  
             }  
             my $emailform = '<input type="text" name="useremail" size="25" value="" />';  
             my $captchaform = &create_captcha();              my $captchaform = &create_captcha();
             my $submit_text = &mt('Request LON-CAPA account');              if ($captchaform) {
             $output .=  '<form name="createaccount" method="post" onSubmit="return validate_email()" action="/adm/createaccount">'.                  my $submit_text = &mt('Request LON-CAPA account');
                         &Apache::lonhtmlcommon::start_pick_box()."\n".                  my $emailform = '<input type="text" name="useremail" size="25" value="" />';
                         &Apache::lonhtmlcommon::row_title(&mt('E-mail address'),                  if (grep(/^login$/,@{$cancreate})) {
                                                          'LC_pick_box_title')."\n".                      $output .= &mt('Provide your e-mail address to request a LON-CAPA account,[_1] if you do not have a log-in ID at your institution.','<br />').'<br /><br />';
                         $emailform."\n".                  } else {
                         &Apache::lonhtmlcommon::row_closure(1).                      $output .= '<br />';
                         &Apache::lonhtmlcommon::row_title(&mt('Validation'),                  }
                                                          'LC_pick_box_title')."\n".                  $output .=  '<form name="createaccount" method="post" onSubmit="return validate_email()" action="/adm/createaccount">'.
                         $captchaform."\n".'<br /><br />';                              &Apache::lonhtmlcommon::start_pick_box()."\n".
             if ($courseid ne '') {                              &Apache::lonhtmlcommon::row_title(&mt('E-mail address'),
                 $output .= '<input type="hidden" name="courseid" value="'.$courseid.'"/>'."\n";                                                                'LC_pick_box_title')."\n".
             }                              $emailform."\n".
             $output .= '<input type="submit" name="create_with_email" value="'.                               &Apache::lonhtmlcommon::row_closure(1).
                         $submit_text.'" />'.                              &Apache::lonhtmlcommon::row_title(&mt('Validation'),
                         &Apache::lonhtmlcommon::row_closure(1).                                                               'LC_pick_box_title')."\n".
                         &Apache::lonhtmlcommon::end_pick_box().'<br /><br />';                              $captchaform."\n".'<br /><br />';
             if ($courseid ne '') {                  if ($courseid ne '') {
                 $output .= &Apache::lonhtmlcommon::echo_form_input(['courseid']);                      $output .= '<input type="hidden" name="courseid" value="'.$courseid.'"/>'."\n"; 
                   }
                   $output .= '<input type="submit" name="create_with_email" value="'. 
                               $submit_text.'" />'.
                               &Apache::lonhtmlcommon::row_closure(1).
                               &Apache::lonhtmlcommon::end_pick_box().'<br /><br />';
                   if ($courseid ne '') {
                       $output .= &Apache::lonhtmlcommon::echo_form_input(['courseid']);
                   }
                   $output .= '</form>';
               } else {
                   my $helpdesk = '/adm/helpdesk?origurl=%2fadm%2fcreateaccount';
                   if ($courseid ne '') {
                       $helpdesk .= '&courseid='.$courseid;
                   }
                   $output .= '<span class="LC_error">'.&mt('An error occurred generating the validation code[_1] required for an e-mail address to be used as username.','<br />').'</span><br /><br />'.&mt('[_1]Contact the helpdesk[_2] or [_3]reload[_2] the page and try again.','<a href="'.$helpdesk.'">','</a>','<a href="javascript:window.location.reload()">');
             }              }
             $output .= '</form></div>';              $output .= '</div>';
         }          }
     }      }
     if ($output eq '') {      if ($output eq '') {
Line 583  sub send_token { Line 592  sub send_token {
     my $token = &Apache::lonnet::tmpput(\%info,$server);      my $token = &Apache::lonnet::tmpput(\%info,$server);
     if ($token !~ /^error/ && $token ne 'no_such_host') {      if ($token !~ /^error/ && $token ne 'no_such_host') {
         my $esc_token = &escape($token);          my $esc_token = &escape($token);
         my $mailmsg = &mt('A request was submitted on [_1] for creation of a LON-CAPA account at the following institution: [_2].',localtime(time),$domdesc).' '.          my $showtime = localtime(time);
              &mt('To complete this process please open a web browser and enter the following'          my $mailmsg = &mt('A request was submitted on [_1] for creation of a LON-CAPA account at the following institution: [_2].',$showtime,$domdesc).' '.
                 .' URL in the address/location box: [_1]'               &mt('To complete this process please open a web browser and enter the following URL in the address/location box: [_1]',
                 ,&Apache::lonnet::absolute_url().'/adm/createaccount?token='.$esc_token);                   &Apache::lonnet::absolute_url().'/adm/createaccount?token='.$esc_token);
         my $result = &Apache::resetpw::send_mail($domdesc,$email,$mailmsg,$contact_name,          my $result = &Apache::resetpw::send_mail($domdesc,$email,$mailmsg,$contact_name,
                                                  $contact_email);                                                   $contact_email);
         if ($result eq 'ok') {          if ($result eq 'ok') {
Line 1122  sub linkto_email_help { Line 1131  sub linkto_email_help {
 sub create_captcha {  sub create_captcha {
     my ($output_dir,$db_dir) = @_;      my ($output_dir,$db_dir) = @_;
     my %captcha_params = &captcha_settings();      my %captcha_params = &captcha_settings();
     my $captcha = Authen::Captcha->new(      my ($output,$maxtries,$tries) = ('',10,0);
                                        output_folder => $captcha_params{'output_dir'},      while ($tries < $maxtries) {
                                        data_folder   => $captcha_params{'db_dir'},          $tries ++;
                                       );          my $captcha = Authen::Captcha->new (
     my $md5sum = $captcha->generate_code($captcha_params{'numchars'});                                             output_folder => $captcha_params{'output_dir'},
     my $output = '<input type="hidden" name="crypt" value="'.$md5sum.'" />'."\n".                                             data_folder   => $captcha_params{'db_dir'},
                  &mt('Type in the letters/numbers shown below').'&nbsp;'.                                            );
                  '<input type="text" size="5" name="code" value="" /><br />'.          my $md5sum = $captcha->generate_code($captcha_params{'numchars'});
                  '<img src="'.$captcha_params{'www_output_dir'}.'/'.$md5sum.'.png">';  
           if (-e $Apache::lonnet::perlvar{'lonCaptchaDir'}.'/'.$md5sum.'.png') {
               $output = '<input type="hidden" name="crypt" value="'.$md5sum.'" />'."\n".
                         &mt('Type in the letters/numbers shown below').'&nbsp;'.
                        '<input type="text" size="5" name="code" value="" /><br />'.
                        '<img src="'.$captcha_params{'www_output_dir'}.'/'.$md5sum.'.png">';
               last;
           }
       }
     return $output;      return $output;
 }  }
   

Removed from v.1.27  
changed lines
  Added in v.1.28


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