--- loncom/interface/loncreateuser.pm 2002/04/18 20:16:43 1.30
+++ loncom/interface/loncreateuser.pm 2002/04/23 21:05:45 1.33
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.30 2002/04/18 20:16:43 matthew Exp $
+# $Id: loncreateuser.pm,v 1.33 2002/04/23 21:05:45 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -47,7 +47,7 @@
# 11/12,11/13,11/15 Scott Harrison
# 02/11/02 Matthew Hall
#
-# $Id: loncreateuser.pm,v 1.30 2002/04/18 20:16:43 matthew Exp $
+# $Id: loncreateuser.pm,v 1.33 2002/04/23 21:05:45 matthew Exp $
###
package Apache::loncreateuser;
@@ -68,116 +68,16 @@ BEGIN {
$ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;
my $krbdefdom=$1;
$krbdefdom=~tr/a-z/A-Z/;
- $authformnop=(<
-
-Do not change login data
-
-END
- $authformkrb=(<
-
-Kerberos authenticated with domain
-
-
-END
- $authformint=(<
-
-Internally authenticated (with initial password
-
-
-END
- $authformfsys=(<
-
-Filesystem authenticated (with initial password
-
-
-END
- $authformloc=(<
-
-Local Authentication with argument
-
-
-END
- $loginscript=(<
-
-var authvalues = new Object();
-authvalues.names = new Array('krbarg','intarg','fsysarg','locarg');
-authvalues.defaults = new Array('MSU.EDU','','','');
-
-function changed_radio(choice,currentform) {
- var choicearg = choice + 'arg';
- if (currentform.elements[choicearg].value == '') {
- clear(currentform,authvalues.names);
- for (var i=0; i
-ENDLOGINSCRIPT
- $generalrule=<
-As a general rule, only authors or co-authors should be filesystem
-authenticated (which allows access to the server filesystem).
-
-END
+ my %param = ( formname => 'document.cu',
+ kerb_def_dom => $krbdefdom
+ );
+ $loginscript = &Apache::loncommon::authform_header(%param);
+ $generalrule = &Apache::loncommon::authform_authorwarning(%param);
+ $authformnop = &Apache::loncommon::authform_nochange(%param);
+ $authformkrb = &Apache::loncommon::authform_kerberos(%param);
+ $authformint = &Apache::loncommon::authform_internal(%param);
+ $authformfsys = &Apache::loncommon::authform_filesystem(%param);
+ $authformloc = &Apache::loncommon::authform_local(%param);
}
# =================================================================== Phase one
@@ -185,7 +85,9 @@ END
sub phase_one {
my $r=shift;
my $defdom=$ENV{'user.domain'};
- $r->print(<print(<<"ENDDOCUMENT");
The LearningOnline Network with CAPA
@@ -194,8 +96,10 @@ sub phase_one {
Create User, Change User Privileges
@@ -212,6 +116,10 @@ sub phase_two {
$ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;
my $krbdefdom=$1;
$krbdefdom=~tr/a-z/A-Z/;
+ my %param = ( formname => 'document.cu',
+ kerb_def_dom => $krbdefdom
+ );
+ $loginscript = &Apache::loncommon::authform_header(%param);
my $defdom=$ENV{'user.domain'};
@@ -221,7 +129,7 @@ sub phase_two {
The LearningOnline Network with CAPA
-
Personal Data
@@ -301,11 +207,11 @@ ID/Student Number $home_server_list
Login Data
-$generalrule
-$authformkrb
-$authformint
-$authformfsys
-$authformloc
+$generalrule
+$authformkrb
+$authformint
+$authformfsys
+$authformloc
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
@@ -421,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.
Login Data
-$generalrule
-$authformkrb
-$authformint
-$authformfsys
-$authformloc
+$generalrule
+$authformkrb
+$authformint
+$authformfsys
+$authformloc
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.
@@ -449,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="$authformint
\n".
+ "$authformfsys
$authformloc
";
}
elsif ($currentauth=~/^internal:/) {
$authformcurrent=$authformint;
- $authform_other=$authformkrb.$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\[1\]/; # int
- $loginscript=~s/login\[0\]/login\[2\]/; # krb4
+ $authform_other="$authformkrb
".
+ "$authformfsys
$authformloc
";
}
elsif ($currentauth=~/^unix:/) {
$authformcurrent=$authformfsys;
- $authform_other=$authformkrb.$authformint.$authformloc;
- # embarrassing script hack here
- $loginscript=~s/login\[3\]/login\[4\]/; # loc
- $loginscript=~s/login\[1\]/login\[3\]/; # int
- $loginscript=~s/login\[2\]/login\[1\]/; # fsys
- $loginscript=~s/login\[0\]/login\[2\]/; # krb4
+ $authform_other="$authformkrb
".
+ "$authformint
$authformloc;
";
}
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=<
@@ -498,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
@@ -654,7 +552,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;
@@ -685,7 +584,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 +833,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