Diff for /loncom/interface/lonpreferences.pm between versions 1.5 and 1.10

version 1.5, 2002/03/30 17:59:34 version 1.10, 2002/08/21 17:18:08
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 $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>  <form name="server" action="/adm/preferences" method="post">
 $errormessage  <input type="hidden" name="action" value="verify_and_change_screenname" />
 <p>  New screenname:
 Change anonymous discussion screen name for $user  <input type="text" size="20" value="$screenname" name="screenname" />
 </p>  <input type="submit" value="Change" />
   </form>
 </body>  </body>
 </html>  </html>
 ENDSCREEN  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';
       }
       my $bodytag=&Apache::loncommon::bodytag(
                                            'Change Your Anonymous Screen Name');
       $r->print(<<ENDVCSCREEN);
   <html>
   $bodytag
   </p>
   $message
   </body></html>
   ENDVCSCREEN
   }
   
 ######################################################  ######################################################
 #            password handler subroutines            #  #            password handler subroutines            #
 ######################################################  ######################################################
Line 154  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 189  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 319  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 336  ENDERROR Line 368  ENDERROR
 #            other handler subroutines               #  #            other handler subroutines               #
 ######################################################  ######################################################
   
   
 ################################################################  ################################################################
 #                          Main handler                        #  #                          Main handler                        #
 ################################################################  ################################################################
Line 349  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') {
  &verify_and_change_password($r);   &verify_and_change_password($r);
     } elsif ($ENV{'form.action'} eq 'changescreenname') {      } elsif ($ENV{'form.action'} eq 'changescreenname') {
         &screennamechanger($r);          &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>
 <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):/) {

Removed from v.1.5  
changed lines
  Added in v.1.10


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