--- loncom/auth/lonauth.pm 2008/07/10 00:26:40 1.93 +++ loncom/auth/lonauth.pm 2008/10/01 11:11:08 1.95 @@ -1,7 +1,7 @@ # The LearningOnline Network # User Authentication Module # -# $Id: lonauth.pm,v 1.93 2008/07/10 00:26:40 raeburn Exp $ +# $Id: lonauth.pm,v 1.95 2008/10/01 11:11:08 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -122,11 +122,12 @@ sub failed { {'no_inline_link' => 1,}); my $end_page = &Apache::loncommon::end_page(); &Apache::loncommon::content_type($r,'text/html'); + sleep 1; # brute force counteraction: slow down attackers, which try to hack user authentication with automated scripts $r->send_http_header; $r->print( $start_page .'

'.&mt('Sorry ...').'

' - .'

'.&mt($message).'

' + .'

'.&mt($message).'

' .'

'.&mt('Please [_1]log in again[_2].' ,"{'uname'}&domain=$form->{'udom'}\">",'') .'

' @@ -298,32 +299,15 @@ sub handler { &Apache::loncommon::build_recipient_list(undef,'helpdeskmail', $form{'udom'},$origmail); my ($contact_email) = split(',',$contacts); - my ($output,$checkfail) = - &Apache::createaccount::username_check($form{'uname'},$form{'udom'}, - $domdesc,undef,$lonhost, - $contact_email); + my $output = &Apache::createaccount::username_check($form{'uname'}, + $form{'udom'},$domdesc,'', + $lonhost,$contact_email,$contact_name); &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; &Apache::createaccount::print_header($r,$start_page); - my $msg = '

'.&mt('Account creation').'

'. - ''.&mt('Although your username and password were authenticated, you do not currently have a LON-CAPA account in this domain.').'
'; - if ($checkfail) { - $msg .= '

'.&mt('Account creation unavailable').'

'; - if ($checkfail eq 'username') { - $msg .= ''. - &mt('A LON-CAPA account may not be created with the username you use.').''; - } elsif ($checkfail eq 'authtoken') { - $msg .= ''.&mt('Error creating token.').''; - } - &Apache::lonnet::logthis("ERROR: failure type of '$checkfail' when performing username check to create account for authenticated user: $form{'uname'}, in domain $form{'udom'}"); - $msg .= '

'. - &mt('Please contact the [_1] ([_2]) for assistance.', - $contact_name,$contact_email); - } else { - $msg .= &mt('To create one, use the table below to provide information about yourself (if appropriate), then click the "Create LON-CAPA account" button.'); - } - $r->print($msg.$output); - $r->print(&Apache::loncommon::end_page()); + $r->print('

'.&mt('Account creation').'

'. + &mt('Although your username and password were authenticated, you do not currently have a LON-CAPA account at this institution.').'
'. + $output.&Apache::loncommon::end_page()); return OK; } else { &failed($r,'Although your username and password were authenticated, you do not currently have a LON-CAPA account in this domain, and you are not permitted to create one.',\%form);