Diff for /loncom/interface/lonpreferences.pm between versions 1.7 and 1.11

version 1.7, 2002/04/03 18:47:39 version 1.11, 2002/08/27 13:23:01
Line 98  sub des_decrypt { Line 98  sub des_decrypt {
 ################################################################  ################################################################
 #                       Handler subroutines                    #  #                       Handler subroutines                    #
 ################################################################  ################################################################
   
   ################################################################
   #         Anonymous Discussion Name Change Subroutines         #
   ################################################################
 sub screennamechanger {  sub screennamechanger {
     my $r = shift;      my $r = shift;
     my $errormessage = shift;  
     $errormessage = ($errormessage || '');  
     my $user       = $ENV{'user.name'};      my $user       = $ENV{'user.name'};
     my $domain     = $ENV{'user.domain'};      my $domain     = $ENV{'user.domain'};
     my $homeserver = $ENV{'user.home'};  
     my %userenv = &Apache::lonnet::get('environment',['screenname']);      my %userenv = &Apache::lonnet::get('environment',['screenname']);
     my $screenname=$userenv{'screenname'};      my $screenname=$userenv{'screenname'};
       my $bodytag=&Apache::loncommon::bodytag(
                                            'Change Your Anonymous Screen Name');
     $r->print(<<ENDSCREEN);      $r->print(<<ENDSCREEN);
 <html>  <html>
 <body bgcolor="#FFFFFF">  $bodytag
 <h1>Preferences for $user</h1>  
 <h3>$user is a member of domain $domain</h3>  
 $errormessage  
 <p>  
 Change anonymous discussion screen name for $user  
 </p>  
   
 <form name="server" action="/adm/preferences" method="post">  <form name="server" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_screenname" />  <input type="hidden" name="action" value="verify_and_change_screenname" />
Line 132  sub verify_and_change_screenname { Line 129  sub verify_and_change_screenname {
     my $r = shift;      my $r = shift;
     my $user       = $ENV{'user.name'};      my $user       = $ENV{'user.name'};
     my $domain     = $ENV{'user.domain'};      my $domain     = $ENV{'user.domain'};
     my $homeserver = $ENV{'user.home'};  
     my $newscreen  = $ENV{'form.screenname'};      my $newscreen  = $ENV{'form.screenname'};
     $newscreen=~s/\W//g;      $newscreen=~s/\W//g;
     my $message='';      my $message='';
Line 145  sub verify_and_change_screenname { Line 141  sub verify_and_change_screenname {
         &Apache::lonnet::delenv('environment\.screenname');          &Apache::lonnet::delenv('environment\.screenname');
         $message='Reset screenname';          $message='Reset screenname';
     }      }
       my $bodytag=&Apache::loncommon::bodytag(
                                            'Change Your Anonymous Screen Name');
     $r->print(<<ENDVCSCREEN);      $r->print(<<ENDVCSCREEN);
 <html>  <html>
 <body bgcolor="#FFFFFF">  $bodytag
 <h1>Preferences for $user</h1>  
 <h3>$user is a member of domain $domain</h3>  
 <p>  
 Change anonymous discussion screen name for $user  
 </p>  </p>
 $message  $message
 </body></html>  </body></html>
Line 194  sub passwordchanger { Line 188  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>);
     }      }
       my $bodytag=&Apache::loncommon::bodytag('Change Password','',
                                            'onLoad="init();"');
     $r->print(<<ENDFORM);      $r->print(<<ENDFORM);
   </head>
 <body bgcolor="#FFFFFF" onLoad="init();">  $bodytag
   
 <script language="JavaScript">  <script language="JavaScript">
   
Line 229  sub passwordchanger { Line 226  sub passwordchanger {
     }      }
   
 </script>  </script>
 <h1>Preferences for $user</h1>  
 <h3>$user is a member of domain $domain</h3>  
 $errormessage  $errormessage
 <p>  
 Change password for $user  
 </p>  
 <p>  <p>
 <!-- We seperate the forms into 'server' and 'client' in order to  <!-- We seperate the forms into 'server' and 'client' in order to
      ensure that unencrypted passwords will not be sent out by a       ensure that unencrypted passwords will not be sent out by a
Line 359  ENDERROR Line 352  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 376  ENDERROR Line 368  ENDERROR
 #            other handler subroutines               #  #            other handler subroutines               #
 ######################################################  ######################################################
   
   
 ################################################################  ################################################################
 #                          Main handler                        #  #                          Main handler                        #
 ################################################################  ################################################################
Line 389  sub handler { Line 380  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') {
Line 404  sub handler { Line 395  sub handler {
 <head>  <head>
 <title>LON-CAPA Preferences</title>  <title>LON-CAPA Preferences</title>
 </head>  </head>
 <body bgcolor="#FFFFFF" >  
 <h1>Preferences for $user</h1>  
 <h3>$user is a member of domain $domain</h3>  
 ENDHEADER  ENDHEADER
           $r->print(&Apache::loncommon::bodytag('Change Your Preferences'));
  # Determine current authentication method   # Determine current authentication method
  my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain);   my $currentauth=&Apache::lonnet::queryauthenticate($user,$domain);
  if ($currentauth =~ /^(unix|internal):/) {   if ($currentauth =~ /^(unix|internal):/) {
Line 424  ENDPASSWORDFORM Line 413  ENDPASSWORDFORM
 <input type="submit" value="Change anonymous discussion screen name">  <input type="submit" value="Change anonymous discussion screen name">
 </form>  </form>
 ENDSCREENNAMEFORM  ENDSCREENNAMEFORM
   # The "about me" page
               my $aboutmeaction=
           '/adm/'.$ENV{'user.domain'}.'/'.$ENV{'user.name'}.'/aboutme';
       $r->print(<<ENDABOUTME);
   <form name="client" action="$aboutmeaction" method="post">
   <input type="hidden" name="action" value="changescreenname">
   <input type="submit" value="Edit the 'About Me' Personal Information Screen">
   </form>
   ENDABOUTME
             # Other preference setting code should be added here              # Other preference setting code should be added here
  }   }
     }      }

Removed from v.1.7  
changed lines
  Added in v.1.11


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