--- loncom/interface/createaccount.pm 2020/09/09 02:12:01 1.72.4.5 +++ loncom/interface/createaccount.pm 2021/12/10 04:14:52 1.85 @@ -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.72.4.5 2020/09/09 02:12:01 raeburn Exp $ +# $Id: createaccount.pm,v 1.85 2021/12/10 04:14:52 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -438,7 +438,9 @@ sub javascript_setforms { } $setuserinfo .= ' server.elements.'.$key.'.value=client.elements.'.$key.'.value;'."\n"; } - $setuserinfo .= ' server.elements.type.value=client.elements.type.value;'."\n"; + if ($usertype ne '') { + $setuserinfo .= ' server.elements.type.value=client.elements.type.value;'."\n"; + } } if ($captcha eq 'original') { $setuserinfo .= ' server.elements.code.value=client.elements.code.value;'."\n". @@ -982,7 +984,8 @@ sub send_token { $msg .= '
'; return $msg; } - my %info = ('ip' => $ENV{'REMOTE_ADDR'}, + my $ip = &Apache::lonnet::get_requestor_ip(); + my %info = ('ip' => $ip, 'time' => $now, 'domain' => $domain, 'username' => $email, @@ -1098,8 +1101,9 @@ sub process_mailtoken { &create_account($r,$domain,$domdesc,\%data); if ($result eq 'ok') { $msg = $output; + my $ip = &Apache::lonnet::get_requestor_ip(); my $shownow = &Apache::lonlocal::locallocaltime($now); - my $mailmsg = &mt('A LON-CAPA account for the institution: [_1] has been created [_2] from IP address: [_3]. If you did not perform this action or authorize it, please contact the [_4] ([_5]).',$domdesc,$shownow,$ENV{'REMOTE_ADDR'},$contact_name,$contact_email)."\n"; + my $mailmsg = &mt('A LON-CAPA account for the institution: [_1] has been created [_2] from IP address: [_3]. If you did not perform this action or authorize it, please contact the [_4] ([_5]).',$domdesc,$shownow,$ip,$contact_name,$contact_email)."\n"; my $mailresult = &Apache::resetpw::send_mail($domdesc,$data{'email'}, $mailmsg,$contact_name, $contact_email); @@ -1179,42 +1183,54 @@ sub print_dataentry_form { my ($lextkey,$uextkey) = &getkeys($lkey,$ukey); my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount:createaccount', $lonhost); - $output .= + my $showsubmit = 1; + my $serverform = ''."\n". - ''.&mt('Fields marked [_1]*[_2] are required.','','').'
'; + my $endclientform; + unless ($showsubmit) { + if ($usertype ne '') { + $endclientform = ''."\n"; + } + } + $endclientform .= ''."\n". + ''."\n". + ''."\n". + ''."\n"; my ($datatable,$rowcount) = &Apache::loncreateuser::personal_data_display('',$domain,'email','selfcreate', '','',$now,$captchaform, $emailusername,$usertype, - $usernameset,$condition,$excluded); + $usernameset,$condition,$excluded, + $showsubmit); if ($rowcount) { - $output .= ''. + &mt('Fields marked [_1]*[_2] are required.','',''). + '
'; } else { $output = &mt('Could not load javascript file [_1]','londes.js'); } @@ -1578,7 +1602,8 @@ sub username_check { ''."\n". ''; my $now = time; - my %info = ('ip' => $ENV{'REMOTE_ADDR'}, + my $ip = &Apache::lonnet::get_requestor_ip(); + my %info = ('ip' => $ip, 'time' => $now, 'domain' => $domain, 'username' => $username);