[LON-CAPA-cvs] cvs: modules /raeburn/register AuthRedirect.pm Session.pm register.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Sat, 04 Dec 2004 21:12:26 -0000
raeburn Sat Dec 4 16:12:26 2004 EDT
Modified files:
/modules/raeburn/register AuthRedirect.pm register.pm Session.pm
Log:
Some modifications made prior to deployment.
Index: modules/raeburn/register/AuthRedirect.pm
diff -u modules/raeburn/register/AuthRedirect.pm:1.2 modules/raeburn/register/AuthRedirect.pm:1.3
--- modules/raeburn/register/AuthRedirect.pm:1.2 Mon Nov 1 14:51:22 2004
+++ modules/raeburn/register/AuthRedirect.pm Sat Dec 4 16:12:26 2004
@@ -66,7 +66,7 @@
ENDONE
} else {
$response .= <<"ENDTWO";
-<font face="arial,helv" size="+1">... heading to the page you requested!</font><br /><br /> <font face="arial,helv" size='2'><a href="$redirecturl"<u>Click here</u></a> if this page has <b>not</b> changed after a few seconds.
+<font face="arial,helv" size="+1">... heading to the page you requested!</font><br /><br /> <font face="arial,helv" size='2'><a href="$redirecturl"><u>Click here</u></a> if this page has <b>not</b> changed after a few seconds.
ENDTWO
$r->header_out("Refresh"=>"2;url=$redirecturl");
}
Index: modules/raeburn/register/register.pm
diff -u modules/raeburn/register/register.pm:1.2 modules/raeburn/register/register.pm:1.3
--- modules/raeburn/register/register.pm:1.2 Mon Nov 1 14:51:22 2004
+++ modules/raeburn/register/register.pm Sat Dec 4 16:12:26 2004
@@ -228,7 +228,11 @@
} elsif ($user =~ /\@/) {
$userinfo{'email'} = $user;
} elsif ($user =~ /^\w{2,8}$/) {
- my $response = &checkmsu($user,\%userinfo);
+ $userinfo{'email'} = $user.'@msu.edu';
+ $userinfo{'institution'} = 'Michigan State University';
+ $userinfo{'citystate'} = 'East Lansing, MI';
+ $userinfo{'zip'} = '48824';
+# my $response = &checkmsu($user,\%userinfo);
}
# Is there already conference data for this user?
@@ -1085,7 +1089,12 @@
push @finalworkshops, @row;
}
$sth->finish;
- my $finalworkshopstr = join(", ",@finalworkshops);
+ my $finalworkshopstr;
+ if (@finalworkshops) {
+ $finalworkshopstr = join(", ",@finalworkshops);
+ } else {
+ $finalworkshopstr = 'None';
+ }
my %statusmsg = (
mail => '',
@@ -1380,7 +1389,6 @@
}
}
-
sub checkmsu {
my ($user,$userinfo) = @_;
$$userinfo{'institution'} = 'Michigan State University';
@@ -1422,7 +1430,6 @@
my $request = new HTTP::Request('GET', "$URL");
my $response = $ua->request($request);
my $dump = $response->content;
-# print STDERR "dump is $dump".$response->status_line."\n";
$adcookie_file->extract_cookies($response);
my $adsession;
my $cookie = $adcookie_file->as_string;
@@ -1446,19 +1453,16 @@
my $response = $ua->request($request);
my $dump = $response->content;
my ($pname,$stamp);
-# print STDERR "dump is $dump".$response->status_line."\n";
if ($dump =~ /input name=\"(\w+)\" type=\"password\"/) {
$pname = $1;
}
if ($dump =~ /\"EncryptedStamp\" value=\"(\w+)\"/) {
$stamp = $1;
}
-# print STDERR "pname is $pname, stamp is $stamp\n";
# AuthenticationMethod = MSU Net AlternateID
$adcookie_file->extract_cookies($response);
my $adsession;
my $cookie = $adcookie_file->as_string;
- print STDERR "cookie is ||$cookie||\n";
if ($cookie =~ /ASPSESSIONID(\w+)=(\w+)/) {
$adsession = $1;
$$cookies{'ASPSESSIONID'} = $2;
@@ -1466,7 +1470,6 @@
if ($cookie =~ /edu\-msu\-ais\-ntweb1\-https=([\d\.]+)/ ) {
$$cookies{'edu-msu-ais-ntweb1-https'} = $1;
}
- print STDERR "adsession is ||$adsession|| and id is ||$$cookies{'ASPSESSIONID'}|| and cookie2 is ||$$cookies{'edu-msu-ais-ntweb1-https'}||\n";
$adcookie_file->clear();
return ($adsession,$pname,$stamp);
}
Index: modules/raeburn/register/Session.pm
diff -u modules/raeburn/register/Session.pm:1.2 modules/raeburn/register/Session.pm:1.3
--- modules/raeburn/register/Session.pm:1.2 Mon Nov 1 14:51:22 2004
+++ modules/raeburn/register/Session.pm Sat Dec 4 16:12:26 2004
@@ -91,9 +91,7 @@
} else {
my $sess_quoted = $dbh->quote( $sess_id );
my $username = $dbh->selectrow_array("SELECT user_id FROM loncapa_sessions WHERE id = $sess_quoted ");
- my $uidflag = 1;
- my $uid;
- if ($uidflag) {
+ unless ($username eq '') {
$r->connection->user("$username");
$r->connection->auth_type($auth_type);
$r->notes('_AUTHFAIL' => 0);
@@ -153,35 +151,30 @@
my $authok = 0;
my %params = ($r->args,$r->content);
my $user = $params{'user'};
- if ($params{'action'} eq 'newaccount') {
- my $email = $params{'email'};
- ($authok,$user) = &create_account($r,$dbh,$email);
- } else {
- my $password = $params{'password'};
- my $authtype = $params{'authtype'};
- my $domain = $params{'domain'};
- my $origurl = $r->notes('_ORIGURL');
- my $upass = '';
- my $tokenin = $params{'tokenin'};
- if (($tokenin ne '') && (-e "/home/helpdesk/tokens/$tokenin")) {
- my $formhash = &Storable::retrieve("/home/helpdesk/tokens/$tokenin");
- my %formInfo = %{$formhash};
- unlink "/home/helpdesk/tokens/$tokenin";
- my $keybin=pack("H16",$formInfo{deskey});
-
- my $cipher = new Crypt::DES $keybin;
-
- $upass=$cipher->decrypt(
- unpack("a8",pack("H16",substr($password,0,16))));
-
- $upass.=$cipher->decrypt(
- unpack("a8",pack("H16",substr($password,16,16))));
-
- $upass=substr($upass,1,ord(substr($upass,0,1)));
- $authok = &authenticate($r,$dbh,$user,$upass,$authtype,$domain);
- if ($authtype eq 'loncapa') {
- $user = $user.':'.$domain;
- }
+ my $password = $params{'password'};
+ my $authtype = $params{'authtype'};
+ my $domain = $params{'domain'};
+ my $origurl = $r->notes('_ORIGURL');
+ my $upass = '';
+ my $tokenin = $params{'tokenin'};
+ if (($tokenin ne '') && (-e "/home/helpdesk/tokens/$tokenin")) {
+ my $formhash = &Storable::retrieve("/home/helpdesk/tokens/$tokenin");
+ my %formInfo = %{$formhash};
+ unlink "/home/helpdesk/tokens/$tokenin";
+ my $keybin=pack("H16",$formInfo{deskey});
+
+ my $cipher = new Crypt::DES $keybin;
+
+ $upass=$cipher->decrypt(
+ unpack("a8",pack("H16",substr($password,0,16))));
+
+ $upass.=$cipher->decrypt(
+ unpack("a8",pack("H16",substr($password,16,16))));
+
+ $upass=substr($upass,1,ord(substr($upass,0,1)));
+ $authok = &authenticate($r,$dbh,$user,$upass,$authtype,$domain);
+ if ($authtype eq 'loncapa') {
+ $user = $user.':'.$domain;
}
}
return ($authok,$user);
@@ -416,7 +409,6 @@
close($fh);
my $udom = $authinfo;
my $response = &loncapa_auth($user_sent,$passwd_sent,$udom,$keyphrase);
-# my $response = &Apache::lonnet::authenticate($user_sent,$passwd_sent,$udom);
if ($response eq 'no_host') {
$r->notes('_RejectAuth' => "Invalid LON-CAPA username and password for domain: $udom");
$authflag = 0;
@@ -448,7 +440,7 @@
my $cipher = Crypt::CBC->new( {'key' => $keyphrase,
'cipher' => 'DES'});
my $ciphertext = $cipher->encrypt_hex($passwd);
- my $URL = "http://raeburn-4.user.msu.edu/cgi-bin/check_auth.pl?";
+ my $URL = "http://s10.lite.msu.edu/cgi-bin/check_auth.pl";
my $request = HTTP::Request->new(POST => $URL);
$request->content_type('application/x-www-form-urlencoded');
$request->content('action=authenticate&username='.$user.'&domain='.$domain.'&key='.$ciphertext);