[LON-CAPA-cvs] cvs: loncom /auth lonauth.pm
raeburn
raeburn at source.lon-capa.org
Thu Sep 29 09:43:22 EDT 2011
raeburn Thu Sep 29 13:43:22 2011 EDT
Modified files:
/loncom/auth lonauth.pm
Log:
- Use createaccount::get_creation_controls() to determine self-creation
configuration if authentication results in: "no_account_on_host".
- Consistent behavior for "New User?" link and log-in via standard log-in
page for users authenticated by institutional log-in (kerberos or localauth)
where domain has set rules for self-creation of accounts, based on
institutional status.
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.118 loncom/auth/lonauth.pm:1.119
--- loncom/auth/lonauth.pm:1.118 Wed Aug 17 03:52:36 2011
+++ loncom/auth/lonauth.pm Thu Sep 29 13:43:22 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network
# User Authentication Module
#
-# $Id: lonauth.pm,v 1.118 2011/08/17 03:52:36 raeburn Exp $
+# $Id: lonauth.pm,v 1.119 2011/09/29 13:43:22 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -40,7 +40,7 @@
use Apache::createaccount;
use Fcntl qw(:flock);
use Apache::lonlocal;
-use Apache::File ();
+use Apache::File();
use HTML::Entities;
# ------------------------------------------------------------ Successful login
@@ -329,21 +329,15 @@
}
# ---------------------------------------------------------------- Authenticate
- my @cancreate;
+
my %domconfig = &Apache::lonnet::get_dom('configuration',['usercreation'],$form{'udom'});
- 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'});
- }
- }
- }
+ my ($cancreate,$statustocreate) =
+ &Apache::createaccount::get_creation_controls($form{'udom'},$domconfig{'usercreation'});
my $defaultauth;
- if (grep(/^login$/, at cancreate)) {
- $defaultauth = 1;
+ if (ref($cancreate) eq 'ARRAY') {
+ if (grep(/^login$/,@{$cancreate})) {
+ $defaultauth = 1;
+ }
}
my $clientcancheckhost = 1;
my $authhost=Apache::lonnet::authenticate($form{'uname'},$upass,
@@ -357,9 +351,7 @@
\%form);
return OK;
} elsif ($authhost eq 'no_account_on_host') {
- my %domconfig =
- &Apache::lonnet::get_dom('configuration',['usercreation'],$form{'udom'});
- if (grep(/^login$/, at cancreate)) {
+ if ($defaultauth) {
my $domdesc = &Apache::lonnet::domain($form{'udom'},'description');
unless (&check_can_host($r,\%form,'no_account_on_host',$domdesc)) {
return OK;
@@ -372,9 +364,11 @@
&Apache::loncommon::build_recipient_list(undef,'helpdeskmail',
$form{'udom'},$origmail);
my ($contact_email) = split(',',$contacts);
- my $output = &Apache::createaccount::username_check($form{'uname'},
- $form{'udom'},$domdesc,'',
- $lonhost,$contact_email,$contact_name);
+ my $output =
+ &Apache::createaccount::username_check($form{'uname'},$form{'udom'},
+ $domdesc,'',$lonhost,
+ $contact_email,$contact_name,
+ undef,$statustocreate);
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
&Apache::createaccount::print_header($r,$start_page);
More information about the LON-CAPA-cvs
mailing list