version 1.4, 2002/02/19 21:50:40
|
version 1.9, 2002/08/19 13:10:55
|
Line 99 sub des_decrypt {
|
Line 99 sub des_decrypt {
|
# Handler subroutines # |
# Handler subroutines # |
################################################################ |
################################################################ |
|
|
|
################################################################ |
|
# Anonymous Discussion Name Change Subroutines # |
|
################################################################ |
|
sub screennamechanger { |
|
my $r = shift; |
|
my $user = $ENV{'user.name'}; |
|
my $domain = $ENV{'user.domain'}; |
|
my %userenv = &Apache::lonnet::get('environment',['screenname']); |
|
my $screenname=$userenv{'screenname'}; |
|
$r->print(<<ENDSCREEN); |
|
<html> |
|
<body bgcolor="#FFFFFF"> |
|
<h1>Preferences for $user</h1> |
|
<h3>$user is a member of domain $domain</h3> |
|
<p> |
|
Change anonymous discussion screen name for $user |
|
</p> |
|
<form name="server" action="/adm/preferences" method="post"> |
|
<input type="hidden" name="action" value="verify_and_change_screenname" /> |
|
New screenname: |
|
<input type="text" size="20" value="$screenname" name="screenname" /> |
|
<input type="submit" value="Change" /> |
|
</form> |
|
</body> |
|
</html> |
|
ENDSCREEN |
|
} |
|
|
|
sub verify_and_change_screenname { |
|
my $r = shift; |
|
my $user = $ENV{'user.name'}; |
|
my $domain = $ENV{'user.domain'}; |
|
my $newscreen = $ENV{'form.screenname'}; |
|
$newscreen=~s/\W//g; |
|
my $message=''; |
|
if ($newscreen) { |
|
&Apache::lonnet::put('environment',{'screenname' => $newscreen}); |
|
&Apache::lonnet::appenv('environment.screenname' => $newscreen); |
|
$message='Set new screenname to '.$newscreen; |
|
} else { |
|
&Apache::lonnet::del('environment',['screenname']); |
|
&Apache::lonnet::delenv('environment\.screenname'); |
|
$message='Reset screenname'; |
|
} |
|
$r->print(<<ENDVCSCREEN); |
|
<html> |
|
<body bgcolor="#FFFFFF"> |
|
<h1>Preferences for $user</h1> |
|
<h3>$user is a member of domain $domain</h3> |
|
<p> |
|
Change anonymous discussion screen name for $user |
|
</p> |
|
$message |
|
</body></html> |
|
ENDVCSCREEN |
|
} |
|
|
###################################################### |
###################################################### |
# password handler subroutines # |
# password handler subroutines # |
###################################################### |
###################################################### |
Line 135 sub passwordchanger {
|
Line 192 sub passwordchanger {
|
$lkey_npass2= hex($lkey_npass2); |
$lkey_npass2= hex($lkey_npass2); |
# Output javascript to deal with passwords |
# Output javascript to deal with passwords |
# Output DES javascript |
# Output DES javascript |
|
$r->print("<html><head>"); |
{ |
{ |
my $include = $r->dir_config('lonIncludes'); |
my $include = $r->dir_config('lonIncludes'); |
my $jsh=Apache::File->new($include."/londes.js"); |
my $jsh=Apache::File->new($include."/londes.js"); |
$r->print(<$jsh>); |
$r->print(<$jsh>); |
} |
} |
$r->print(<<ENDFORM); |
$r->print(<<ENDFORM); |
|
</head> |
<body bgcolor="#FFFFFF" onLoad="init();"> |
<body bgcolor="#FFFFFF" onLoad="init();"> |
|
|
<script language="JavaScript"> |
<script language="JavaScript"> |
Line 300 ENDERROR
|
Line 358 ENDERROR
|
# Inform the user the password has (not?) been changed |
# Inform the user the password has (not?) been changed |
if ($result =~ /^ok$/) { |
if ($result =~ /^ok$/) { |
$r->print(<<"ENDTEXT"); |
$r->print(<<"ENDTEXT"); |
<h2>Password for $user was successfully changed</h2> |
<h2>The password for $user was successfully changed</h2> |
ENDTEXT |
ENDTEXT |
} else { |
} else { |
# error error: run in circles, scream and shout |
# error error: run in circles, scream and shout |
$r->print(<<ENDERROR); |
$r->print(<<ENDERROR); |
<h2><font color="#ff0000">Password for $user was not changed</font></h2> |
<h2><font color="#ff0000">The password for $user was not changed</font></h2> |
There was an internal error when attempting to change your password. |
Please make sure your old password was entered correctly. |
Please contact your instructor or the domain coordinator. |
|
ENDERROR |
ENDERROR |
} |
} |
return; |
return; |
Line 317 ENDERROR
|
Line 374 ENDERROR
|
# other handler subroutines # |
# other handler subroutines # |
###################################################### |
###################################################### |
|
|
|
|
################################################################ |
################################################################ |
# Main handler # |
# Main handler # |
################################################################ |
################################################################ |
Line 330 sub handler {
|
Line 386 sub handler {
|
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK if $r->header_only; |
# Spit out the header |
# |
if ($ENV{'form.action'} eq 'changepass') { |
if ($ENV{'form.action'} eq 'changepass') { |
&passwordchanger($r); |
&passwordchanger($r); |
} elsif ($ENV{'form.action'} eq 'verify_and_change_pass') { |
} elsif ($ENV{'form.action'} eq 'verify_and_change_pass') { |
&verify_and_change_password($r); |
&verify_and_change_password($r); |
|
} elsif ($ENV{'form.action'} eq 'changescreenname') { |
|
&screennamechanger($r); |
|
} elsif ($ENV{'form.action'} eq 'verify_and_change_screenname') { |
|
&verify_and_change_screenname($r); |
} else { |
} else { |
$r->print(<<ENDHEADER); |
$r->print(<<ENDHEADER); |
<html> |
<html> |
Line 354 ENDHEADER
|
Line 414 ENDHEADER
|
<input type="submit" value="Change password"> |
<input type="submit" value="Change password"> |
</form> |
</form> |
ENDPASSWORDFORM |
ENDPASSWORDFORM |
|
# Change screen name |
|
$r->print(<<ENDSCREENNAMEFORM); |
|
<form name="client" action="/adm/preferences" method="post"> |
|
<input type="hidden" name="action" value="changescreenname"> |
|
<input type="submit" value="Change anonymous discussion screen name"> |
|
</form> |
|
ENDSCREENNAMEFORM |
# Other preference setting code should be added here |
# Other preference setting code should be added here |
} |
} |
} |
} |