ENDNEWUSER
} else { # user already exists
$r->print(< 'document.cu',
+ kerb_def_dom => $krbdefdom
+ );
+ $loginscript = &Apache::loncommon::authform_header(%param);
}
# Check for a bad authentication type
unless ($currentauth=~/^krb4:/ or
@@ -424,23 +330,27 @@ END
if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) {
$r->print(<
+
ERROR:
This user has an unrecognized authentication scheme ($currentauth).
Please specify login data below.
ENDBADAUTH
} else {
# This user is not allowed to modify the users
# authentication scheme, so just notify them of the problem
$r->print(<
+
ERROR:
This user has an unrecognized authentication scheme ($currentauth).
Please alert a domain coordinator of this situation.
@@ -452,40 +362,23 @@ ENDBADAUTH
my $authform_other='';
if ($currentauth=~/^krb4:/) {
$authformcurrent=$authformkrb;
- $authform_other=$authformint.$authformfsys.$authformloc;
- # embarrassing script hack here
- $loginscript=~s/login\[3\]/login\[4\]/; # loc
- $loginscript=~s/login\[2\]/login\[3\]/; # fsys
- $loginscript=~s/login\[1\]/login\[2\]/; # int
- $loginscript=~s/login\[0\]/login\[1\]/; # krb4
+ $authform_other="
";
}
elsif ($currentauth=~/^localauth:/) {
$authformcurrent=$authformloc;
- $authform_other=$authformkrb.$authformint.$authformfsys;
- # embarrassing script hack here
- $loginscript=~s/login\[3\]/login\[loc\]/; # loc
- $loginscript=~s/login\[2\]/login\[4\]/; # fsys
- $loginscript=~s/login\[1\]/login\[3\]/; # int
- $loginscript=~s/login\[0\]/login\[2\]/; # krb4
- $loginscript=~s/login\[loc\]/login\[1\]/; # loc
+ $authform_other="
$authformkrb
".
+ "
$authformint
$authformfsys
";
}
$authformcurrent=<
@@ -501,11 +394,13 @@ ENDCURRENTAUTH
# Current user has login modification privileges
$r->print(<
+
Change Current Login Data
-$generalrule
-$authformnop
-$authformcurrent
+
$generalrule
+
$authformnop
+
$authformcurrent
Enter New Login Data
$authform_other
ENDOTHERAUTHS
@@ -626,17 +521,26 @@ ENDTHREEHEAD
my $genpwd='';
if ($ENV{'form.login'} eq 'krb') {
$amode='krb4';
- $genpwd=$ENV{'form.krbdom'};
+ $genpwd=$ENV{'form.krbarg'};
} elsif ($ENV{'form.login'} eq 'int') {
$amode='internal';
- $genpwd=$ENV{'form.intpwd'};
+ $genpwd=$ENV{'form.intarg'};
} elsif ($ENV{'form.login'} eq 'fsys') {
$amode='unix';
- $genpwd=$ENV{'form.fsyspwd'};
+ $genpwd=$ENV{'form.fsysarg'};
} elsif ($ENV{'form.login'} eq 'loc') {
$amode='localauth';
$genpwd=$ENV{'form.locarg'};
$genpwd=" " if (!$genpwd);
+ } elsif (($ENV{'form.login'} eq 'nochange') ||
+ ($ENV{'form.login'} eq '' )) {
+ # There is no need to tell the user we did not change what they
+ # did not ask us to change.
+ # If they are creating a new user but have not specified login
+ # information this will be caught below.
+ } else {
+ $r->print($error.'Invalid login mode or password'.$end);
+ return;
}
if ($ENV{'form.makeuser'}) {
# Create a new user
@@ -654,7 +558,8 @@ ENDNEWUSERHEAD
if (lc($desiredhost) eq 'default') {
$desiredhost = undef;
} else {
- my %home_servers = &get_home_servers($ENV{'form.ccdomain'});
+ my %home_servers = &Apache::loncommon::get_home_servers
+ ($ENV{'form.ccdomain'});
if (! exists($home_servers{$desiredhost})) {
$r->print($error.'Invalid home server specified');
return;
@@ -672,7 +577,8 @@ ENDNEWUSERHEAD
$ENV{'form.ccdomain'});
$r->print(' Home server: '.$home.' '.
$Apache::lonnet::libserv{$home});
- } elsif ($ENV{'form.login'} ne '') {
+ } elsif (($ENV{'form.login'} ne 'nochange') &&
+ ($ENV{'form.login'} ne '' )) {
# Modify user privileges
$r->print(<Change User Privileges
@@ -685,7 +591,7 @@ ENDMODIFYUSERHEAD
# Only allow authentification modification if the person has authority
if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) {
$r->print('Modifying authentication: '.
- &Apache::lonnet::modifyuserauth(
+ &Apache::lonnet::modifyuserauth(
$ENV{'form.ccdomain'},$ENV{'form.ccuname'},
$amode,$genpwd));
$r->print(' Home server: '.&Apache::lonnet::homeserver
@@ -934,16 +840,6 @@ ENDTABLE
#---------------------------------------------- end functions for &phase_two
#--------------------------------- functions for &phase_two and &phase_three
-sub get_home_servers {
- my $domain = shift;
- my %home_servers;
- foreach (keys(%Apache::lonnet::libserv)) {
- if ($Apache::lonnet::hostdom{$_} eq $domain) {
- $home_servers{$_} = $Apache::lonnet::hostname{$_};
- }
- }
- return %home_servers;
-}
#--------------------------end of functions for &phase_two and &phase_three