Annotation of loncom/interface/lonpreferences.pm, revision 1.17

1.1       www         1: # The LearningOnline Network
                      2: # Preferences
                      3: #
1.17    ! matthew     4: # $Id: lonpreferences.pm,v 1.16 2002/10/16 19:36:25 albertel Exp $
1.2       albertel    5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
                     27: #
1.1       www        28: # (Internal Server Error Handler
                     29: #
                     30: # (Login Screen
                     31: # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
                     32: # 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer)
                     33: #
                     34: # 3/1/1 Gerd Kortemeyer)
                     35: #
                     36: # 3/1 Gerd Kortemeyer
                     37: #
1.3       matthew    38: # 2/13/02 2/14 2/15 Matthew Hall
                     39: #
                     40: # This package uses the "londes.js" javascript code. 
                     41: #
                     42: # TODOs that have to be completed:
                     43: #    interface with lonnet to change the password
                     44:  
1.1       www        45: package Apache::lonpreferences;
                     46: 
                     47: use strict;
                     48: use Apache::Constants qw(:common);
1.3       matthew    49: use Apache::File;
                     50: use Crypt::DES;
                     51: use DynaLoader; # for Crypt::DES version
1.4       matthew    52: use Apache::loncommon();
1.3       matthew    53: 
                     54: #
                     55: # Write lonnet::passwd to do the call below.
                     56: # Use:
                     57: #   my $answer=reply("encrypt:passwd:$udom:$uname:$upass",$tryserver);
                     58: #
                     59: ##################################################
                     60: #          password associated functions         #
                     61: ##################################################
                     62: sub des_keys {
1.4       matthew    63:     # Make a new key for DES encryption.
                     64:     # Each key has two parts which are returned seperately.
                     65:     # Please note:  Each key must be passed through the &hex function
                     66:     # before it is output to the web browser.  The hex versions cannot
                     67:     # be used to decrypt.
1.3       matthew    68:     my @hexstr=('0','1','2','3','4','5','6','7',
                     69:                 '8','9','a','b','c','d','e','f');
                     70:     my $lkey='';
                     71:     for (0..7) {
                     72:         $lkey.=$hexstr[rand(15)];
                     73:     }
                     74:     my $ukey='';
                     75:     for (0..7) {
                     76:         $ukey.=$hexstr[rand(15)];
                     77:     }
                     78:     return ($lkey,$ukey);
                     79: }
                     80: 
                     81: sub des_decrypt {
                     82:     my ($key,$cyphertext) = @_;
                     83:     my $keybin=pack("H16",$key);
                     84:     my $cypher;
                     85:     if ($Crypt::DES::VERSION>=2.03) {
                     86:         $cypher=new Crypt::DES $keybin;
                     87:     } else {
                     88:         $cypher=new DES $keybin;
                     89:     }
                     90:     my $plaintext=
                     91: 	$cypher->decrypt(unpack("a8",pack("H16",substr($cyphertext,0,16))));
                     92:     $plaintext.=
                     93: 	$cypher->decrypt(unpack("a8",pack("H16",substr($cyphertext,16,16))));
1.4       matthew    94:     $plaintext=substr($plaintext,1,ord(substr($plaintext,0,1)) );
1.3       matthew    95:     return $plaintext;
                     96: }
                     97: 
1.4       matthew    98: ################################################################
                     99: #                       Handler subroutines                    #
                    100: ################################################################
1.9       matthew   101: 
                    102: ################################################################
                    103: #         Anonymous Discussion Name Change Subroutines         #
                    104: ################################################################
1.5       www       105: sub screennamechanger {
                    106:     my $r = shift;
                    107:     my $user       = $ENV{'user.name'};
                    108:     my $domain     = $ENV{'user.domain'};
1.14      www       109:     my %userenv = &Apache::lonnet::get
                    110:         ('environment',['screenname','nickname']);
1.6       www       111:     my $screenname=$userenv{'screenname'};
1.14      www       112:     my $nickname=$userenv{'nickname'};
1.10      www       113:     my $bodytag=&Apache::loncommon::bodytag(
1.14      www       114:               'Change Your Nickname and Anonymous Screen Name');
1.5       www       115:     $r->print(<<ENDSCREEN);
                    116: <html>
1.10      www       117: $bodytag
                    118: 
1.6       www       119: <form name="server" action="/adm/preferences" method="post">
                    120: <input type="hidden" name="action" value="verify_and_change_screenname" />
1.14      www       121: <br />New screenname (shown if you post anonymously):
1.6       www       122: <input type="text" size="20" value="$screenname" name="screenname" />
1.14      www       123: <br />New nickname (shown if you post non-anonymously):
                    124: <input type="text" size="20" value="$nickname" name="nickname" />
1.6       www       125: <input type="submit" value="Change" />
                    126: </form>
1.5       www       127: </body>
                    128: </html>
                    129: ENDSCREEN
                    130: }
1.6       www       131: 
                    132: sub verify_and_change_screenname {
                    133:     my $r = shift;
                    134:     my $user       = $ENV{'user.name'};
                    135:     my $domain     = $ENV{'user.domain'};
1.14      www       136: # Screenname
1.6       www       137:     my $newscreen  = $ENV{'form.screenname'};
1.14      www       138:     $newscreen=~s/[^ \w]//g;
1.6       www       139:     my $message='';
                    140:     if ($newscreen) {
1.7       www       141:         &Apache::lonnet::put('environment',{'screenname' => $newscreen});
                    142:         &Apache::lonnet::appenv('environment.screenname' => $newscreen);
1.6       www       143:         $message='Set new screenname to '.$newscreen;
                    144:     } else {
                    145:         &Apache::lonnet::del('environment',['screenname']);
1.7       www       146:         &Apache::lonnet::delenv('environment\.screenname');
1.6       www       147:         $message='Reset screenname';
                    148:     }
1.14      www       149: # Nickname
                    150:     $message.='<br />';
1.17    ! matthew   151:     $newscreen  = $ENV{'form.nickname'};
1.14      www       152:     $newscreen=~s/[^ \w]//g;
                    153:     if ($newscreen) {
                    154:         &Apache::lonnet::put('environment',{'nickname' => $newscreen});
                    155:         &Apache::lonnet::appenv('environment.nickname' => $newscreen);
                    156:         $message.='Set new nickname to '.$newscreen;
                    157:     } else {
                    158:         &Apache::lonnet::del('environment',['nickname']);
                    159:         &Apache::lonnet::delenv('environment\.nickname');
                    160:         $message.='Reset nickname';
                    161:     }
                    162: 
1.10      www       163:     my $bodytag=&Apache::loncommon::bodytag(
1.14      www       164:                     'Change Your Nickname and Anonymous Screen Name');
1.6       www       165:     $r->print(<<ENDVCSCREEN);
                    166: <html>
1.10      www       167: $bodytag
1.6       www       168: </p>
                    169: $message
                    170: </body></html>
                    171: ENDVCSCREEN
                    172: }
                    173: 
1.12      www       174: ################################################################
                    175: #         Message Forward                                      #
                    176: ################################################################
                    177: 
                    178: sub msgforwardchanger {
                    179:     my $r = shift;
                    180:     my $user       = $ENV{'user.name'};
                    181:     my $domain     = $ENV{'user.domain'};
                    182:     my %userenv = &Apache::lonnet::get('environment',['msgforward']);
                    183:     my $msgforward=$userenv{'msgforward'};
                    184:     my $bodytag=&Apache::loncommon::bodytag(
                    185:                                          'Change Your Message Forwarding');
                    186:     $r->print(<<ENDMSG);
                    187: <html>
                    188: $bodytag
                    189: 
                    190: <form name="server" action="/adm/preferences" method="post">
                    191: <input type="hidden" name="action" value="verify_and_change_msgforward" />
                    192: New Forwarding Address(es) (<tt>user:domain,user:domain,...</tt>):
                    193: <input type="text" size="40" value="$msgforward" name="msgforward" />
                    194: <input type="submit" value="Change" />
                    195: </form>
                    196: </body>
                    197: </html>
                    198: ENDMSG
                    199: }
                    200: 
                    201: sub verify_and_change_msgforward {
                    202:     my $r = shift;
                    203:     my $user       = $ENV{'user.name'};
                    204:     my $domain     = $ENV{'user.domain'};
                    205:     my $newscreen  = '';
                    206:     my $message='';
                    207:     foreach (split(/\,/,$ENV{'form.msgforward'})) {
                    208: 	my ($msuser,$msdomain)=split(/[\@\:]/,$_);
                    209:         $msuser=~s/\W//g;
                    210:         $msdomain=~s/\W//g;
                    211:         if (($msuser) && ($msdomain)) {
                    212: 	    if (&Apache::lonnet::homeserver($msuser,$msdomain) ne 'no_host') {
                    213:                $newscreen.=$msuser.':'.$msdomain.',';
                    214: 	   } else {
                    215:                $message.='No such user: '.$msuser.':'.$msdomain.'<br>';
                    216:            }
                    217:         }
                    218:     }
                    219:     $newscreen=~s/\,$//;
                    220:     if ($newscreen) {
                    221:         &Apache::lonnet::put('environment',{'msgforward' => $newscreen});
                    222:         &Apache::lonnet::appenv('environment.msgforward' => $newscreen);
                    223:         $message.='Set new message forwarding to '.$newscreen;
                    224:     } else {
                    225:         &Apache::lonnet::del('environment',['msgforward']);
                    226:         &Apache::lonnet::delenv('environment\.msgforward');
                    227:         $message.='Reset message forwarding';
                    228:     }
                    229:     my $bodytag=&Apache::loncommon::bodytag(
                    230:                                          'Change Your Message Forwarding');
                    231:     $r->print(<<ENDVCMSG);
                    232: <html>
                    233: $bodytag
                    234: </p>
                    235: $message
                    236: </body></html>
                    237: ENDVCMSG
                    238: }
                    239: 
1.4       matthew   240: ######################################################
                    241: #            password handler subroutines            #
                    242: ######################################################
1.3       matthew   243: sub passwordchanger {
1.4       matthew   244:     # This function is a bit of a mess....
1.3       matthew   245:     # Passwords are encrypted using londes.js (DES encryption)
                    246:     my $r = shift;
1.4       matthew   247:     my $errormessage = shift;
                    248:     $errormessage = ($errormessage || '');
1.3       matthew   249:     my $user       = $ENV{'user.name'};
                    250:     my $domain     = $ENV{'user.domain'};
                    251:     my $homeserver = $ENV{'user.home'};
                    252:     my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain);
                    253:     # Check for authentication types that allow changing of the password.
                    254:     return if ($currentauth !~ /^(unix|internal):/);
                    255:     #
                    256:     # Generate keys
                    257:     my ($lkey_cpass ,$ukey_cpass ) = &des_keys();
                    258:     my ($lkey_npass1,$ukey_npass1) = &des_keys();
                    259:     my ($lkey_npass2,$ukey_npass2) = &des_keys();
1.4       matthew   260:     # Store the keys in the log files
1.3       matthew   261:     my $lonhost = $r->dir_config('lonHostID');
                    262:     my $logtoken=Apache::lonnet::reply('tmpput:'
                    263: 				       .$ukey_cpass  . $lkey_cpass .'&'
                    264: 				       .$ukey_npass1 . $lkey_npass1.'&'
                    265: 				       .$ukey_npass2 . $lkey_npass2,
                    266: 				       $lonhost);
1.4       matthew   267:     # Hexify the keys for output as javascript variables
1.3       matthew   268:     $ukey_cpass = hex($ukey_cpass);
                    269:     $lkey_cpass = hex($lkey_cpass);
                    270:     $ukey_npass1= hex($ukey_npass1);
                    271:     $lkey_npass1= hex($lkey_npass1);
                    272:     $ukey_npass2= hex($ukey_npass2);
                    273:     $lkey_npass2= hex($lkey_npass2);
                    274:     # Output javascript to deal with passwords
1.4       matthew   275:     # Output DES javascript
1.9       matthew   276:     $r->print("<html><head>");
1.3       matthew   277:     {
                    278: 	my $include = $r->dir_config('lonIncludes');
                    279: 	my $jsh=Apache::File->new($include."/londes.js");
                    280: 	$r->print(<$jsh>);
                    281:     }
1.10      www       282:     my $bodytag=&Apache::loncommon::bodytag('Change Password','',
                    283:                                          'onLoad="init();"');
1.3       matthew   284:     $r->print(<<ENDFORM);
1.9       matthew   285: </head>
1.10      www       286: $bodytag
1.1       www       287: 
1.3       matthew   288: <script language="JavaScript">
                    289: 
                    290:     function send() {
                    291:         uextkey=this.document.client.elements.ukey_cpass.value;
                    292:         lextkey=this.document.client.elements.lkey_cpass.value;
                    293:         initkeys();
                    294: 
                    295:         this.document.server.elements.currentpass.value
                    296:             =crypted(this.document.client.elements.currentpass.value);
                    297: 
                    298:         uextkey=this.document.client.elements.ukey_npass1.value;
                    299:         lextkey=this.document.client.elements.lkey_npass1.value;
                    300:         initkeys();
                    301:         this.document.server.elements.newpass_1.value
                    302:             =crypted(this.document.client.elements.newpass_1.value);
                    303: 
                    304:         uextkey=this.document.client.elements.ukey_npass2.value;
                    305:         lextkey=this.document.client.elements.lkey_npass2.value;
                    306:         initkeys();
                    307:         this.document.server.elements.newpass_2.value
                    308:             =crypted(this.document.client.elements.newpass_2.value);
                    309: 
                    310:         this.document.server.submit();
                    311:     }
                    312: 
                    313: </script>
1.4       matthew   314: $errormessage
1.10      www       315: 
1.3       matthew   316: <p>
                    317: <!-- We seperate the forms into 'server' and 'client' in order to
                    318:      ensure that unencrypted passwords will not be sent out by a
                    319:      crappy browser -->
                    320: 
                    321: <form name="server" action="/adm/preferences" method="post">
                    322: <input type="hidden" name="logtoken"    value="$logtoken" />
                    323: <input type="hidden" name="action"      value="verify_and_change_pass" />
                    324: <input type="hidden" name="currentpass" value="" />
1.4       matthew   325: <input type="hidden" name="newpass_1"   value="" />
                    326: <input type="hidden" name="newpass_2"   value="" />
1.3       matthew   327: </form>
                    328: 
                    329: <form name="client" >
                    330: <table>
1.4       matthew   331: <tr><td align="right"> Current password:                      </td>
                    332:     <td><input type="password" name="currentpass" size="10"/> </td></tr>
                    333: <tr><td align="right"> New password:                          </td>
                    334:     <td><input type="password" name="newpass_1" size="10"  /> </td></tr>
                    335: <tr><td align="right"> Confirm password:                      </td>
                    336:     <td><input type="password" name="newpass_2" size="10"  /> </td></tr>
1.3       matthew   337: <tr><td colspan="2" align="center">
                    338:     <input type="button" value="Change Password" onClick="send();">
                    339: </table>
1.4       matthew   340: <input type="hidden" name="ukey_cpass"  value="$ukey_cpass" />
                    341: <input type="hidden" name="lkey_cpass"  value="$lkey_cpass" />
1.3       matthew   342: <input type="hidden" name="ukey_npass1" value="$ukey_npass1" />
                    343: <input type="hidden" name="lkey_npass1" value="$lkey_npass1" />
                    344: <input type="hidden" name="ukey_npass2" value="$ukey_npass2" />
                    345: <input type="hidden" name="lkey_npass2" value="$lkey_npass2" />
                    346: </form>
                    347: </p>
                    348: ENDFORM
                    349:     #
                    350:     return;
                    351: }
                    352: 
                    353: sub verify_and_change_password {
                    354:     my $r = shift;
                    355:     my $user       = $ENV{'user.name'};
                    356:     my $domain     = $ENV{'user.domain'};
                    357:     my $homeserver = $ENV{'user.home'};
                    358:     my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain);
1.4       matthew   359:     # Check for authentication types that allow changing of the password.
                    360:     return if ($currentauth !~ /^(unix|internal):/);
1.3       matthew   361:     #
1.4       matthew   362:     $r->print(<<ENDHEADER);
                    363: <html>
                    364: <head>
                    365: <title>LON-CAPA Preferences:  Change password for $user</title>
                    366: </head>
                    367: ENDHEADER
1.3       matthew   368:     #
                    369:     my $currentpass = $ENV{'form.currentpass'}; 
                    370:     my $newpass1    = $ENV{'form.newpass_1'}; 
                    371:     my $newpass2    = $ENV{'form.newpass_2'};
                    372:     my $logtoken    = $ENV{'form.logtoken'};
                    373:     # Check for empty data 
1.4       matthew   374:     unless (defined($currentpass) && 
                    375: 	    defined($newpass1)    && 
                    376: 	    defined($newpass2)    ){
                    377: 	&passwordchanger($r,"<p>\n<font color='#ff0000'>ERROR</font>".
                    378: 			 "Password data was blank.\n</p>");
1.3       matthew   379: 	return;
                    380:     }
1.16      albertel  381:     # Get the keys
                    382:     my $lonhost = $r->dir_config('lonHostID');
1.3       matthew   383:     my $tmpinfo = Apache::lonnet::reply('tmpget:'.$logtoken,$lonhost);
                    384:     if (($tmpinfo=~/^error/) || ($tmpinfo eq 'con_lost')) {
1.4       matthew   385:         # I do not a have a better idea about how to handle this
1.3       matthew   386: 	$r->print(<<ENDERROR);
                    387: <p>
                    388: <font color="#ff0000">ERROR:</font> Unable to retrieve stored token for
1.4       matthew   389: password decryption.  Please log out and try again.
1.3       matthew   390: </p>
                    391: ENDERROR
1.4       matthew   392:         # Probably should log an error here
1.3       matthew   393:         return;
                    394:     }
                    395:     my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo);
1.4       matthew   396:     # 
1.17    ! matthew   397:     $currentpass = &des_decrypt($ckey ,$currentpass);
        !           398:     $newpass1    = &des_decrypt($n1key,$newpass1);
        !           399:     $newpass2    = &des_decrypt($n2key,$newpass2);
1.4       matthew   400:     # 
1.3       matthew   401:     if ($newpass1 ne $newpass2) {
1.4       matthew   402: 	&passwordchanger($r,
                    403: 			 '<font color="#ff0000">ERROR:</font>'.
                    404: 			 'The new passwords you entered do not match.  '.
                    405: 			 'Please try again.');
                    406: 	return;
                    407:     }
                    408:     if (length($newpass1) < 7) {
                    409: 	&passwordchanger($r,
                    410: 			 '<font color="#ff0000">ERROR:</font>'.
                    411: 			 'Passwords must be a minimum of 7 characters long.  '.
                    412: 			 'Please try again.');
1.3       matthew   413: 	return;
                    414:     }
1.4       matthew   415:     #
                    416:     # Check for bad characters
                    417:     my $badpassword = 0;
                    418:     foreach (split(//,$newpass1)) {
                    419: 	$badpassword = 1 if ((ord($_)<32)||(ord($_)>126));
                    420:     }
                    421:     if ($badpassword) {
                    422: 	# I can't figure out how to enter bad characters on my browser.
                    423: 	&passwordchanger($r,<<ENDERROR);
                    424: <font color="#ff0000">ERROR:</font>
                    425: The password you entered contained illegal characters.<br />
                    426: Valid characters are: space and <br />
                    427: <pre>
                    428: !&quot;\#$%&amp;\'()*+,-./0123456789:;&lt;=&gt;?\@
                    429: ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}~
                    430: </pre>
                    431: ENDERROR
                    432:     }
                    433:     # 
                    434:     # Change the password (finally)
                    435:     my $result = &Apache::lonnet::changepass
                    436: 	($user,$domain,$currentpass,$newpass1,$homeserver);
                    437:     # Inform the user the password has (not?) been changed
                    438:     if ($result =~ /^ok$/) {
                    439: 	$r->print(<<"ENDTEXT");
1.9       matthew   440: <h2>The password for $user was successfully changed</h2>
1.4       matthew   441: ENDTEXT
                    442:     } else {
                    443: 	# error error: run in circles, scream and shout
                    444:         $r->print(<<ENDERROR);
1.9       matthew   445: <h2><font color="#ff0000">The password for $user was not changed</font></h2>
1.8       matthew   446: Please make sure your old password was entered correctly.
1.4       matthew   447: ENDERROR
                    448:     }
                    449:     return;
1.3       matthew   450: }
                    451: 
1.4       matthew   452: ######################################################
                    453: #            other handler subroutines               #
                    454: ######################################################
                    455: 
1.3       matthew   456: ################################################################
                    457: #                          Main handler                        #
                    458: ################################################################
1.1       www       459: sub handler {
                    460:     my $r = shift;
1.3       matthew   461:     my $user = $ENV{'user.name'};
                    462:     my $domain = $ENV{'user.domain'};
1.1       www       463:     $r->content_type('text/html');
1.4       matthew   464:     # Some pages contain DES keys and should not be cached.
                    465:     &Apache::loncommon::no_cache($r);
1.1       www       466:     $r->send_http_header;
                    467:     return OK if $r->header_only;
1.9       matthew   468:     #
1.3       matthew   469:     if ($ENV{'form.action'} eq 'changepass') {
                    470: 	&passwordchanger($r);
                    471:     } elsif ($ENV{'form.action'} eq 'verify_and_change_pass') {
                    472: 	&verify_and_change_password($r);
1.5       www       473:     } elsif ($ENV{'form.action'} eq 'changescreenname') {
                    474:         &screennamechanger($r);
1.6       www       475:     } elsif ($ENV{'form.action'} eq 'verify_and_change_screenname') {
                    476:         &verify_and_change_screenname($r);
1.12      www       477:     } elsif ($ENV{'form.action'} eq 'changemsgforward') {
                    478:         &msgforwardchanger($r);
                    479:     } elsif ($ENV{'form.action'} eq 'verify_and_change_msgforward') {
                    480:         &verify_and_change_msgforward($r);
1.15      albertel  481:     } elsif ($ENV{'form.action'} eq 'debugtoggle') {
                    482: 	if ($ENV{'user.name'} eq 'albertel' ) {
                    483: 	    if ($ENV{'user.debug'}) {
                    484: 		&Apache::lonnet::delenv('user\.debug');
                    485: 	    } else {
                    486: 		&Apache::lonnet::appenv('user.debug' => 1);
                    487: 	    }
                    488: 	}
1.3       matthew   489:     } else {
                    490: 	$r->print(<<ENDHEADER);
1.1       www       491: <html>
                    492: <head>
1.4       matthew   493: <title>LON-CAPA Preferences</title>
1.1       www       494: </head>
1.3       matthew   495: ENDHEADER
1.10      www       496:         $r->print(&Apache::loncommon::bodytag('Change Your Preferences'));
1.3       matthew   497: 	# Determine current authentication method
                    498: 	my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain);
                    499: 	if ($currentauth =~ /^(unix|internal):/) {
1.4       matthew   500: 	    $r->print(<<ENDPASSWORDFORM);
                    501: <form name="client" action="/adm/preferences" method="post">
1.14      www       502: <input type="hidden" name="action" value="changepass" />
                    503: <input type="submit" value="Change password" />
1.4       matthew   504: </form>
                    505: ENDPASSWORDFORM
1.13      www       506:         }
1.5       www       507: # Change screen name
                    508: 	    $r->print(<<ENDSCREENNAMEFORM);
                    509: <form name="client" action="/adm/preferences" method="post">
1.14      www       510: <input type="hidden" name="action" value="changescreenname" />
                    511: <input type="submit" 
                    512: value="Change nickname and anonymous discussion screen name" />
1.5       www       513: </form>
                    514: ENDSCREENNAMEFORM
1.12      www       515: 	    $r->print(<<ENDMSGFORWARDFORM);
                    516: <form name="client" action="/adm/preferences" method="post">
1.14      www       517: <input type="hidden" name="action" value="changemsgforward" />
                    518: <input type="submit" value="Change message forwarding address" />
1.12      www       519: </form>
                    520: ENDMSGFORWARDFORM
1.11      www       521: # The "about me" page
1.15      albertel  522: 	my $aboutmeaction=
                    523: 	    '/adm/'.$ENV{'user.domain'}.'/'.$ENV{'user.name'}.'/aboutme';
                    524: 	$r->print(<<ENDABOUTME);
1.11      www       525: <form name="client" action="$aboutmeaction" method="post">
1.14      www       526: <input type="hidden" name="action" value="changescreenname" />
                    527: <input type="submit" value="Edit the 'About Me' Personal Information Screen" />
1.11      www       528: </form>
                    529: ENDABOUTME
1.15      albertel  530: 	if ($ENV{'user.name'} eq 'albertel') {
                    531: 	    $r->print(<<ENDDEBUG);
                    532: <form name="client" action="/adm/preferences" method="post">
                    533: <input type="hidden" name="action" value="debugtoggle" />
                    534: <input type="submit" value="Toggle Debug" />
                    535: Current Debug status is -$ENV{'user.debug'}-.
                    536: </form>
                    537: ENDDEBUG
                    538: 	}
                    539: 	# Other preference setting code should be added here
1.3       matthew   540:     }
                    541:     $r->print(<<ENDFOOTER);
1.1       www       542: </body>
                    543: </html>
1.3       matthew   544: ENDFOOTER
1.1       www       545:     return OK;
1.13      www       546: }
1.1       www       547: 
                    548: 1;
                    549: __END__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>