[Koha-cvs] CVS: koha member-password.pl,1.3,1.4

Mike Hansen wolfpac444 at users.sourceforge.net
Sun Mar 16 10:20:00 CET 2003


Update of /cvsroot/koha/koha
In directory sc8-pr-cvs1:/tmp/cvs-serv14380/koha

Modified Files:
	member-password.pl 
Log Message:
Changed to use templates


Index: member-password.pl
===================================================================
RCS file: /cvsroot/koha/koha/member-password.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** member-password.pl	3 Feb 2003 21:42:41 -0000	1.3
--- member-password.pl	16 Mar 2003 09:19:57 -0000	1.4
***************
*** 1,26 ****
  #!/usr/bin/perl
- 
  #script to set the password, and optionally a userid, for a borrower
  #written 2/5/00
  #by chris at katipo.co.nz
  
  use strict;
- 
- use C4::Search;
- use CGI;
- use Digest::MD5 qw(md5_base64);
- use C4::Output;
  use C4::Auth;
  use C4::Context;
  use C4::Circulation::Circ2;
! #use C4::Acquisitions;
  
  my $input = new CGI;
  
  my $flagsrequired;
  $flagsrequired->{borrowers}=1;
  my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
  
- #print $input->header;
  my $member=$input->param('member');
  my %env;
--- 1,37 ----
  #!/usr/bin/perl
  #script to set the password, and optionally a userid, for a borrower
  #written 2/5/00
  #by chris at katipo.co.nz
+ #converted to using templates 3/16/03 by mwhansen at hmc.edu
  
  use strict;
  use C4::Auth;
+ use C4::Output;
+ use C4::Interface::CGI::Output;
+ use C4::Search;
  use C4::Context;
  use C4::Circulation::Circ2;
! use CGI;
! use HTML::Template;
! use Digest::MD5 qw(md5_base64);
  
  my $input = new CGI;
  
+ my $theme = $input->param('theme') || "default";
+ 			# only used if allowthemeoverride is set
+ 
+ my ($template, $loggedinuser, $cookie)
+     = get_template_and_user({template_name => "members/member-password.tmpl",
+ 			     query => $input,
+ 			     type => "intranet",
+ 			     authnotrequired => 0,
+ 			     flagsrequired => {borrowers => 1},
+ 			     debug => 1,
+ 			     });
+ 
  my $flagsrequired;
  $flagsrequired->{borrowers}=1;
  my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
  
  my $member=$input->param('member');
  my %env;
***************
*** 33,37 ****
      $i++;
  }
! if ($input->param('newpassword')) {
      my $digest=md5_base64($input->param('newpassword'));
      my $uid = $input->param('newuserid');
--- 44,51 ----
      $i++;
  }
! 
! my $newpassword = $input->param('newpassword');
! 
! if ( $newpassword ) {
      my $digest=md5_base64($input->param('newpassword'));
      my $uid = $input->param('newuserid');
***************
*** 39,43 ****
      my $sth=$dbh->prepare("update borrowers set userid=?, password=? where borrowernumber=?");
      $sth->execute($uid, $digest, $member);
-     print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$member");
  } else {
      my ($bor,$flags)=getpatroninformation(\%env, $member,'');
--- 53,56 ----
***************
*** 50,80 ****
  	$defaultnewpassword.=substr($chars, int(rand(length($chars))),1);
      }
!     my $spellitout=$defaultnewpassword;
!     $spellitout=~s/l/\001/g;
!     $spellitout=~s/1/\002/g;
!     $spellitout=~s/O/\003/g;
!     $spellitout=~s/o/\004/g;
!     $spellitout=~s/0/\005/g;
!     $spellitout=~s/\001/ <b>el<\/b> /g;
!     $spellitout=~s/\002/ <b>one<\/b> /g;
!     $spellitout=~s/\003/ <b>Oh<\/b> /g;
!     $spellitout=~s/\004/ <b>oh<\/b> /g;
!     $spellitout=~s/\005/ <b>zero<\/b> /g;
! 
!     print $input->header(-cookie => $cookie);
!     print startpage();
!     print startmenu('member');
!     print qq|
!     <h2>$bor->{'surname'}, $bor->{'firstname'}</h2>
!     <form method=post>
!     <input type=hidden name=member value=$member>
!     New UserID: <input name=newuserid size=20 value=$userid> <br>
!     New Password: <input name=newpassword size=20 value=$defaultnewpassword>
!     <p>
!     <input type=submit value="Confirm Password">
!     </form>
!     |;
  
-     print endmenu('member');
-     print endpage();
  }
--- 63,75 ----
  	$defaultnewpassword.=substr($chars, int(rand(length($chars))),1);
      }
!     $template->param(	surname     => $bor->{'surname'},
! 			firstname   => $bor->{'firstname'},
! 			userid      => $bor->{'userid'},
! 			defaultnewpassword => $defaultnewpassword );
! 
  
  }
+ 
+ $template->param( member => $member, newpassword => $newpassword );
+ 
+ output_html_with_http_headers $input, $cookie, $template->output;





More information about the Koha-cvs mailing list