Diff for /loncom/interface/createaccount.pm between versions 1.32.2.1 and 1.37.2.5

version 1.32.2.1, 2009/09/14 15:33:48 version 1.37.2.5, 2010/12/02 02:15:11
Line 63  sub handler { Line 63  sub handler {
     &Apache::lonlocal::get_language_handle($r);      &Apache::lonlocal::get_language_handle($r);
   
     if ($sso_username ne '' && $sso_domain ne '') {      if ($sso_username ne '' && $sso_domain ne '') {
         $domain = $sso_domain;          $domain = $sso_domain; 
     } else {      } else {
         $domain = &Apache::lonnet::default_login_domain();          $domain = &Apache::lonnet::default_login_domain();
         if (defined($env{'form.courseid'})) {          if (defined($env{'form.courseid'})) {
Line 92  sub handler { Line 92  sub handler {
         my $end_page =          my $end_page =
             &Apache::loncommon::end_page();              &Apache::loncommon::end_page();
         $r->print($start_page."\n".'<h2>'.&mt('You are already logged in').'</h2>'.          $r->print($start_page."\n".'<h2>'.&mt('You are already logged in').'</h2>'.
                   '<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]logout[_4].','<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>').                    '<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].','<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>').
                   '</p><p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'.$end_page);                    '</p><p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'.$end_page);
         return OK;          return OK;
     }      }
Line 112  sub handler { Line 112  sub handler {
         if ($env{'form.udom'} ne '') {          if ($env{'form.udom'} ne '') {
             $domain = $env{'form.udom'};              $domain = $env{'form.udom'};
         }          }
   
           my %domconfig = 
               &Apache::lonnet::get_dom('configuration',['usercreation'],$domain);
           my ($cancreate,$statustocreate) = 
               &get_creation_controls($domain,$domconfig{'usercreation'});
   
         my ($result,$output) =          my ($result,$output) =
             &username_validation($r,$env{'form.uname'},$domain,$domdesc,              &username_validation($r,$env{'form.uname'},$domain,$domdesc,
                                  $contact_name,$contact_email,$courseid,                                   $contact_name,$contact_email,$courseid,
                                  $lonhost);                                   $lonhost,$statustocreate);
         if ($result eq 'existingaccount') {          if ($result eq 'existingaccount') {
             $r->print($output);              $r->print($output);
             &print_footer($r);              &print_footer($r);
Line 133  sub handler { Line 139  sub handler {
     $start_page =      $start_page =
         &Apache::loncommon::start_page($title,$js,          &Apache::loncommon::start_page($title,$js,
                                        {'no_inline_link'   => 1,});                                         {'no_inline_link'   => 1,});
     my @cancreate;  
     my %domconfig = &Apache::lonnet::get_dom('configuration',['usercreation'],$domain);  
     if (ref($domconfig{'usercreation'}) eq 'HASH') {  
         if (ref($domconfig{'usercreation'}{'cancreate'}) eq 'HASH') {  
             if (ref($domconfig{'usercreation'}{'cancreate'}{'selfcreate'}) eq 'ARRAY') {  
                 @cancreate = @{$domconfig{'usercreation'}{'cancreate'}{'selfcreate'}};  
             } elsif (($domconfig{'usercreation'}{'cancreate'}{'selfcreate'} ne 'none') &&  
                      ($domconfig{'usercreation'}{'cancreate'}{'selfcreate'} ne '')) {  
                 @cancreate = ($domconfig{'usercreation'}{'cancreate'}{'selfcreate'});  
             }  
         }  
     }  
   
     if (@cancreate == 0) {      my %domconfig = 
           &Apache::lonnet::get_dom('configuration',['usercreation'],$domain);
       my ($cancreate,$statustocreate) = &get_creation_controls($domain,$domconfig{'usercreation'});
       if (@{$cancreate} == 0) {
         &print_header($r,$start_page,$courseid);          &print_header($r,$start_page,$courseid);
         my $output = '<h3>'.&mt('Account creation unavailable').'</h3>'.          my $output = '<h3>'.&mt('Account creation unavailable').'</h3>'.
                      '<span class="LC_warning">'.                       '<span class="LC_warning">'.
Line 160  sub handler { Line 157  sub handler {
         &print_header($r,$start_page,$courseid);          &print_header($r,$start_page,$courseid);
         my ($msg,$sso_logout);          my ($msg,$sso_logout);
         $sso_logout = &sso_logout_frag($r,$domain);          $sso_logout = &sso_logout_frag($r,$domain);
         if (grep(/^sso$/,@cancreate)) {          if (grep(/^sso$/,@{$cancreate})) {
             $msg = '<h3>'.&mt('Account creation').'</h3>'.              $msg = '<h3>'.&mt('Account creation').'</h3>'.
                    &mt("Although your username and password were authenticated by your institution's Single Sign On system, you do not currently have a LON-CAPA account at this institution.").'<br />';                     &mt("Although your username and password were authenticated by your institution's Single Sign On system, you do not currently have a LON-CAPA account at this institution.").'<br />';
   
             $msg .= &username_check($sso_username,$domain,$domdesc,$courseid,               $msg .= &username_check($sso_username,$domain,$domdesc,$courseid, 
                                     $lonhost,$contact_email,$contact_name,$sso_logout);                                      $lonhost,$contact_email,$contact_name,
                                       $sso_logout,$statustocreate);
         } else {          } else {
             $msg = '<h3>'.&mt('Account creation unavailable').'</h3>'.              $msg = '<h3>'.&mt('Account creation unavailable').'</h3>'.
                    '<span class="LC_warning">'.&mt("Although your username and password were authenticated by your institution's Single Sign On system, you do not currently have a LON-CAPA account at this institution, and you are not permitted to create one.").'</span><br /><br />'.&mt('Please contact the [_1] ([_2]) for assistance.',$contact_name,$contact_email).'<hr />'.                     '<span class="LC_warning">'.&mt("Although your username and password were authenticated by your institution's Single Sign On system, you do not currently have a LON-CAPA account at this institution, and you are not permitted to create one.").'</span><br /><br />'.&mt('Please contact the [_1] ([_2]) for assistance.',$contact_name,$contact_email).'<hr />'.
Line 215  sub handler { Line 213  sub handler {
         (my $result,$output) =           (my $result,$output) = 
             &username_validation($r,$env{'form.uname'},$domain,$domdesc,              &username_validation($r,$env{'form.uname'},$domain,$domdesc,
                                  $contact_name,$contact_email,$courseid,                                   $contact_name,$contact_email,$courseid,
                                  $lonhost);                                   $lonhost,$statustocreate);
         if ($result eq 'existingaccount') {          if ($result eq 'existingaccount') {
             $r->print($output);              $r->print($output);
             &print_footer($r);              &print_footer($r);
Line 226  sub handler { Line 224  sub handler {
     } elsif ($env{'form.create_with_email'}) {      } elsif ($env{'form.create_with_email'}) {
         &print_header($r,$start_page,$courseid);          &print_header($r,$start_page,$courseid);
         $output = &process_email_request($env{'form.useremail'},$domain,$domdesc,          $output = &process_email_request($env{'form.useremail'},$domain,$domdesc,
                                          $contact_name,$contact_email,\@cancreate,                                           $contact_name,$contact_email,$cancreate,
                                          $lonhost,$domconfig{'usercreation'},                                           $lonhost,$domconfig{'usercreation'},
                                          $courseid);                                           $courseid);
     } elsif (!$token) {      } elsif (!$token) {
         &print_header($r,$start_page,$courseid);          &print_header($r,$start_page,$courseid);
         my $now=time;          my $now=time;
         if (grep(/^login$/,@cancreate)) {          if (grep(/^login$/,@{$cancreate})) {
             my $jsh=Apache::File->new($include."/londes.js");              my $jsh=Apache::File->new($include."/londes.js");
             $r->print(<$jsh>);              $r->print(<$jsh>);
             $r->print(&javascript_setforms($now));              $r->print(&javascript_setforms($now));
         }          }
         if (grep(/^email$/,@cancreate)) {          if (grep(/^email$/,@{$cancreate})) {
             $r->print(&javascript_validmail());              $r->print(&javascript_validmail());
         }          }
         $output = &print_username_form($domain,$domdesc,\@cancreate,$now,$lonhost,          $output = &print_username_form($domain,$domdesc,$cancreate,$now,$lonhost,
                                        $courseid);                                         $courseid);
     }      }
     $r->print($output);      $r->print($output);
Line 280  sub selfenroll_crumbs { Line 278  sub selfenroll_crumbs {
     my ($r,$courseid,$desc) = @_;      my ($r,$courseid,$desc) = @_;
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
          ({href=>"javascript:ToCatalog('backupcrumbs','')",           ({href=>"javascript:ToCatalog('backupcrumbs','')",
            text=>"Course Catalog"});             text=>"Course/Community Catalog"});
     if ($env{'form.coursenum'} ne '') {      if ($env{'form.coursenum'} ne '') {
         &Apache::lonhtmlcommon::add_breadcrumb          &Apache::lonhtmlcommon::add_breadcrumb
           ({href=>"javascript:ToCatalog('backupcrumbs','details')",            ({href=>"javascript:ToCatalog('backupcrumbs','details')",
Line 376  function validate_email() { Line 374  function validate_email() {
     if (validmail(field) == false) {      if (validmail(field) == false) {
         alert("$lt{'email'}: "+field.value+" $lt{'notv'}.");          alert("$lt{'email'}: "+field.value+" $lt{'notv'}.");
         return false;          return false;
       } else {
          var emailaddr = field.value;
          var lcemail = emailaddr.toLowerCase();
          if (emailaddr != lcemail) {
              field.value = lcemail;
              alert("WebCenter usernames are all lower case.\\nAccordingly your username will be "+lcemail+" once activated.");
          }
     }      }
     return true;      return true;
 }  }
Line 422  sub print_username_form { Line 427  sub print_username_form {
                             &Apache::lonhtmlcommon::row_closure(1).                              &Apache::lonhtmlcommon::row_closure(1).
                             &Apache::lonhtmlcommon::row_title(&mt('Validation'),                              &Apache::lonhtmlcommon::row_title(&mt('Validation'),
                                                              'LC_pick_box_title')."\n".                                                               'LC_pick_box_title')."\n".
                             $captchaform."\n".'<br /><br />';                              $captchaform."\n".
                               &mt('If either word is hard to read, [_1] will replace them.','<image src="/res/adm/pages/refresh.gif" alt="reCAPTCHA refresh" />').'<br /><br />';
                 if ($courseid ne '') {                  if ($courseid ne '') {
                     $output .= '<input type="hidden" name="courseid" value="'.$courseid.'"/>'."\n";                       $output .= '<input type="hidden" name="courseid" value="'.$courseid.'"/>'."\n"; 
                 }                  }
Line 469  sub login_box { Line 475  sub login_box {
     my $unameform = '<input type="text" name="uname" size="20" value="" />';      my $unameform = '<input type="text" name="uname" size="20" value="" />';
     my $upassform = '<input type="password" name="upass'.$now.'" size="20" />';      my $upassform = '<input type="password" name="upass'.$now.'" size="20" />';
     $output .= '<form name="client" method="post" onsubmit="return(send());">'."\n".      $output .= '<form name="client" method="post" onsubmit="return(send());">'."\n".
                  '<input type="hidden" name="udom" value="'.$domain.'" />'.
                &Apache::lonhtmlcommon::start_pick_box()."\n".                 &Apache::lonhtmlcommon::start_pick_box()."\n".
                &Apache::lonhtmlcommon::row_title($titles{$context},                 &Apache::lonhtmlcommon::row_title($titles{$context},
                                                  'LC_pick_box_title')."\n".                                                   'LC_pick_box_title')."\n".
Line 476  sub login_box { Line 483  sub login_box {
                &Apache::lonhtmlcommon::row_closure(1)."\n".                 &Apache::lonhtmlcommon::row_closure(1)."\n".
                &Apache::lonhtmlcommon::row_title(&mt('Password'),                 &Apache::lonhtmlcommon::row_title(&mt('Password'),
                                                 'LC_pick_box_title')."\n".                                                  'LC_pick_box_title')."\n".
                $upassform."\n".'<br /><br />'."\n".                 $upassform;
                '<input type="button" name="username_validation" value="'.      $output .= &Apache::lonhtmlcommon::row_closure(1).
                $submit_text.'" onclick="javascript:send()" />'."\n".                 &Apache::lonhtmlcommon::row_title().
                &Apache::lonhtmlcommon::row_closure(1)."\n".                 '<br /><input type="submit" name="username_validation" value="'.
                &Apache::lonhtmlcommon::end_pick_box()."\n".                 $submit_text.'" />'."\n";
                '<p><a href="/adm/resetpw">'.&mt('Forgot password?').'</a>'.      if ($context eq 'selfenroll') {
                '</p>'."\n".          $output .= '<br /><br /><table width="100%"><tr><td align="right">'.
                '<input type="hidden" name="lextkey" value="'.$lextkey.'">'."\n".                     '<span class="LC_fontsize_medium">'.
                '<input type="hidden" name="uextkey" value="'.$uextkey.'">'."\n".                     '<a href="/adm/resetpw">'.&mt('Forgot password?').'</a>'.
                      '</span></td></tr></table>'."\n";
       }
       $output .= &Apache::lonhtmlcommon::row_closure(1)."\n".
                  &Apache::lonhtmlcommon::end_pick_box().'<br />'."\n";
       $output .= '<input type="hidden" name="lextkey" value="'.$lextkey.'" />'."\n".
                  '<input type="hidden" name="uextkey" value="'.$uextkey.'" />'."\n".
                '</form>';                 '</form>';
     return $output;      return $output;
 }  }
Line 492  sub login_box { Line 505  sub login_box {
 sub process_email_request {  sub process_email_request {
     my ($useremail,$domain,$domdesc,$contact_name,$contact_email,$cancreate,      my ($useremail,$domain,$domdesc,$contact_name,$contact_email,$cancreate,
         $server,$settings,$courseid) = @_;          $server,$settings,$courseid) = @_;
     $useremail = $env{'form.useremail'};      $useremail = lc($env{'form.useremail'});
     my $output;      my $output;
     if (ref($cancreate) eq 'ARRAY') {      if (ref($cancreate) eq 'ARRAY') {
         if (!grep(/^email$/,@{$cancreate})) {          if (!grep(/^email$/,@{$cancreate})) {
Line 507  sub process_email_request { Line 520  sub process_email_request {
             my $uhome = &Apache::lonnet::homeserver($useremail,$domain);              my $uhome = &Apache::lonnet::homeserver($useremail,$domain);
             if ($uhome ne 'no_host') {              if ($uhome ne 'no_host') {
                 $output = &invalid_state('existinguser',$domdesc,                  $output = &invalid_state('existinguser',$domdesc,
                                          $contact_name,$contact_email);                                           $contact_name,$contact_email,'',$useremail);
                 return $output;                  return $output;
             } else {              } else {
                  my $captcha = Captcha::reCAPTCHA->new;                   my $captcha = Captcha::reCAPTCHA->new;
Line 517  sub process_email_request { Line 530  sub process_email_request {
                                             $ENV{'REMOTE_ADDR'},                                              $ENV{'REMOTE_ADDR'},
                                             $env{'form.recaptcha_challenge_field'},                                              $env{'form.recaptcha_challenge_field'},
                                             $env{'form.recaptcha_response_field'},                                              $env{'form.recaptcha_response_field'},
                                            ); # generate private key for IP                                             );
                                               # from http://recaptcha.net/  
                 if (!$captcha_result->{is_valid}) {                  if (!$captcha_result->{is_valid}) {
                     $output = &invalid_state('captcha',$domdesc,$contact_name,                      $output = &invalid_state('captcha',$domdesc,$contact_name,
                                              $contact_email);                                               $contact_email);
   
                     return $output;                      return $output;
                 }                  }
                 my $uhome=&Apache::lonnet::homeserver($useremail,$domain);                  my $uhome=&Apache::lonnet::homeserver($useremail,$domain);
Line 584  sub send_token { Line 597  sub send_token {
     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 $showtime = localtime(time);          my $showtime = localtime(time);
         my $mailmsg = &mt('A request was submitted on [_1] for creation of a GCI WebCenter account.',$showtime).' '.          my $mailmsg = &mt('A request was submitted on [_1] for creation of a GCI WebCenter account.',$showtime)." \n".
              &mt('To complete this process please open a web browser and enter the following 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);                   "\n\n".&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 707  sub print_dataentry_form { Line 720  sub print_dataentry_form {
         my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount',          my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount',
                                            $lonhost);                                             $lonhost);
         my $formtag = '<form name="server" method="post" target="_top" action="/adm/createaccount">';          my $formtag = '<form name="server" method="post" target="_top" action="/adm/createaccount">';
         my ($datatable,$rowcount,$editable) =          my ($datatable,$rowcount) =
             &Apache::loncreateuser::personal_data_display($username,$domain,              &Apache::loncreateuser::personal_data_display($username,$domain,
                                                           'email','selfcreate');                                                            'email','selfcreate');
         if ($rowcount) {          if ($rowcount) {
Line 771  ENDSERVERFORM Line 784  ENDSERVERFORM
     return $output;      return $output;
 }  }
   
   sub get_creation_controls {
       my ($domain,$usercreation) = @_;
       my (@cancreate,@statustocreate);
       if (ref($usercreation) eq 'HASH') {
           if (ref($usercreation->{'cancreate'}) eq 'HASH') {
               if (ref($usercreation->{'cancreate'}{'statustocreate'}) eq 'ARRAY') {
                   @statustocreate = @{$usercreation->{'cancreate'}{'statustocreate'}};
               } else {
                   @statustocreate = ('default');
                   my ($othertitle,$usertypes,$types) =
                       &Apache::loncommon::sorted_inst_types($domain);
                   if (ref($types) eq 'ARRAY') {
                       push(@statustocreate,@{$types});
                   }
               }
               if (ref($usercreation->{'cancreate'}{'selfcreate'}) eq 'ARRAY') {
                   @cancreate = @{$usercreation->{'cancreate'}{'selfcreate'}};
               } elsif (($usercreation->{'cancreate'}{'selfcreate'} ne 'none') &&
                        ($usercreation->{'cancreate'}{'selfcreate'} ne '')) {
                   @cancreate = ($usercreation->{'cancreate'}{'selfcreate'});
               }
           }
       }
       return (\@cancreate,\@statustocreate);
   }
   
 sub create_account {  sub create_account {
     my ($r,$domain,$lonhost,$username,$domdesc) = @_;      my ($r,$domain,$lonhost,$username,$domdesc) = @_;
     my ($retrieved,$output,$upass) = &process_credentials($env{'form.logtoken'},      my ($retrieved,$output,$upass) = &process_credentials($env{'form.logtoken'},
Line 808  sub create_account { Line 847  sub create_account {
   
 sub username_validation {  sub username_validation {
     my ($r,$username,$domain,$domdesc,$contact_name,$contact_email,$courseid,      my ($r,$username,$domain,$domdesc,$contact_name,$contact_email,$courseid,
         $lonhost) = @_;          $lonhost,$statustocreate) = @_;
     my ($retrieved,$output,$upass);      my ($retrieved,$output,$upass);
   
     $username= &LONCAPA::clean_username($username);      $username= &LONCAPA::clean_username($username);
Line 824  sub username_validation { Line 863  sub username_validation {
         my $result = &Apache::lonnet::authenticate($username,$upass,$domain);          my $result = &Apache::lonnet::authenticate($username,$upass,$domain);
         if ($result ne 'no_host') {           if ($result ne 'no_host') { 
             my %form = &start_session($r,$username,$domain,$lonhost,$courseid);              my %form = &start_session($r,$username,$domain,$lonhost,$courseid);
             $output = '<br /><br />'.&mt('A GCI WebCenter account already exists for username [_1].','<tt>'.$username.'</tt>').'<br />'.&mt('The password entered was also correct so you have been logged in.');              $output = '<br /><br />'.&mt('A LON-CAPA account already exists for username [_1] at this institution ([_2]).','<tt>'.$username.'</tt>',$domdesc).'<br />'.&mt('The password entered was also correct so you have been logged in.');
             return ('existingaccount',$output);              return ('existingaccount',$output);
         } else {          } else {
             $output = &login_failure_msg($courseid);              $output = &login_failure_msg($courseid);
Line 842  sub username_validation { Line 881  sub username_validation {
         }          }
         if ($authok eq 'authorized') {          if ($authok eq 'authorized') {
             $output = &username_check($username,$domain,$domdesc,$courseid,$lonhost,              $output = &username_check($username,$domain,$domdesc,$courseid,$lonhost,
                                       $contact_email,$contact_name);                                        $contact_email,$contact_name,undef,
                                         $statustocreate);
         } else {          } else {
             $output = &login_failure_msg($courseid);              $output = &login_failure_msg($courseid);
         }          }
Line 867  sub login_failure_msg { Line 907  sub login_failure_msg {
 }  }
   
 sub username_check {  sub username_check {
     my ($username,$domain,$domdesc,$courseid,$lonhost,$contact_email,$contact_name,      my ($username,$domain,$domdesc,$courseid,$lonhost,$contact_email,
         $sso_logout) = @_;          $contact_name,$sso_logout,$statustocreate) = @_;
     my (%rulematch,%inst_results,$checkfail,$rowcount,$editable,$output,$msg,      my (%rulematch,%inst_results,$checkfail,$rowcount,$editable,$output,$msg,
         %alerts,%curr_rules,%got_rules);          %alerts,%curr_rules,%got_rules);
     &call_rulecheck($username,$domain,\%alerts,\%rulematch,      &call_rulecheck($username,$domain,\%alerts,\%rulematch,
Line 888  sub username_check { Line 928  sub username_check {
         }          }
     }      }
     if (!$checkfail) {      if (!$checkfail) {
           if (ref($statustocreate) eq 'ARRAY') {
               $checkfail = 'inststatus';
               if (ref($inst_results{$username.':'.$domain}{inststatus}) eq 'ARRAY') {
                   foreach my $inststatus (@{$inst_results{$username.':'.$domain}{inststatus}}) {
                       if (grep(/^\Q$inststatus\E$/,@{$statustocreate})) {
                           undef($checkfail);
                           last;
                       }
                   }
               } elsif (grep(/^default$/,@{$statustocreate})) {
                   undef($checkfail);
               }
           }
       }
       if (!$checkfail) {
         $output = '<form method="post" action="/adm/createaccount">';          $output = '<form method="post" action="/adm/createaccount">';
         (my $datatable,$rowcount,$editable) =           (my $datatable,$rowcount,$editable) = 
             &Apache::loncreateuser::personal_data_display($username,$domain,1,'selfcreate',              &Apache::loncreateuser::personal_data_display($username,$domain,1,'selfcreate',
Line 922  sub username_check { Line 977  sub username_check {
         } elsif ($checkfail eq 'authtoken') {          } elsif ($checkfail eq 'authtoken') {
             $msg .= '<span class="LC_error">'.&mt('Error creating token.').'</span>'.              $msg .= '<span class="LC_error">'.&mt('Error creating token.').'</span>'.
                     '<br />'.$output;                      '<br />'.$output;
           } elsif ($checkfail eq 'inststatus') {
               $msg .= '<span class="LC_warning">'.
                        &mt('You are not permitted to create a LON-CAPA account.').
                        '</span><br /><br />'.$output;
         }          }
         $msg .= &mt('Please contact the [_1] ([_2]) for assistance.',          $msg .= &mt('Please contact the [_1] ([_2]) for assistance.',
                 $contact_name,$contact_email).'<br /><hr />'.                  $contact_name,$contact_email).'<br /><hr />'.
Line 1070  sub check_id { Line 1129  sub check_id {
 }  }
   
 sub invalid_state {  sub invalid_state {
     my ($error,$domdesc,$contact_name,$contact_email,$msgtext) = @_;      my ($error,$domdesc,$contact_name,$contact_email,$msgtext,$useremail) = @_;
     my $msg = '<h3>'.&mt('Account creation unavailable').'</h3><span class="LC_error">';      my $msg = '<h3>'.&mt('Account creation unavailable').'</h3><span class="LC_error">';
     if ($error eq 'baduseremail') {      if ($error eq 'baduseremail') {
         $msg = &mt('The e-mail address you provided does not appear to be a valid address.');          $msg .= &mt('The e-mail address you provided does not appear to be a valid address.');
     } elsif ($error eq 'existinguser') {      } elsif ($error eq 'existinguser') {
         $msg = &mt('The e-mail address you provided is already in use as a username in LON-CAPA at this institution.');          my $uname = &HTML::Entities::encode($useremail);
           $msg .= &mt('The e-mail address you provided is already in use as a username in LON-CAPA at this institution.').'</span><br /><br /><span class="LC_warning">'.&mt('You can either:').'<ul>'.
                   '<li>'.&mt('Return to the [_1]log-in page[_2] and enter your password.','<a href="/adm/login?username='.$uname.'">','</a>').'</li>'.
                   '<li>'.&mt('or, if you do not remember your password, visit the "[_1]Forgot your password?[_2]" page.','<a href="/adm/resetpw?uname='.$uname.'&useremail='.$uname.'&referrer=createaccount">','</a>').
                   '</li></ul>';
     } elsif ($error eq 'userrules') {      } elsif ($error eq 'userrules') {
         $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') {      } elsif ($error eq 'captcha') {
         $msg = &mt('Validation of the code your entered failed.');          $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.');
     }      }
     $msg .= '</span>';      $msg .= '</span>';
     if ($msgtext) {      if ($msgtext) {
Line 1108  sub linkto_email_help { Line 1171  sub linkto_email_help {
 sub create_recaptcha {  sub create_recaptcha {
     my $captcha = Captcha::reCAPTCHA->new;      my $captcha = Captcha::reCAPTCHA->new;
     return $captcha->get_options_setter({theme => 'white'})."\n".      return $captcha->get_options_setter({theme => 'white'})."\n".
            $captcha->get_html('PUBLICKEY');  # generate public key for IP             $captcha->get_html('PUBLICKEY'); # generate public key for IP
                                              # from http://recaptcha.net/                                              # from http://recaptcha.net/
 }  }
   
 sub getkeys {  sub getkeys {

Removed from v.1.32.2.1  
changed lines
  Added in v.1.37.2.5


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