| Lines 28-38
          my ( $template, $loggedinuser, $cookie, $staffflags ) = get_template_and_user(
      
      
        Link Here | 
        
          | 28 |         template_name   => "members/member-password.tt", | 28 |         template_name   => "members/member-password.tt", | 
        
          | 29 |         query           => $input, | 29 |         query           => $input, | 
        
          | 30 |         type            => "intranet", | 30 |         type            => "intranet", | 
          
            
              | 31 |         flagsrequired   => { borrowers => 'edit_borrowers' }, | 31 |         flagsrequired   => { catalogue => 1 }, | 
        
          | 32 |     } | 32 |     } | 
        
          | 33 | ); | 33 | ); | 
        
          | 34 |  | 34 |  | 
        
          | 35 | my $patron_id    = $input->param('member'); | 35 | my $patron_id    = $input->param('member'); | 
            
              |  |  | 36 | my $logged_in_user = Koha::Patrons->find( $loggedinuser ); | 
            
              | 37 |  | 
            
              | 38 | if ( !$logged_in_user->has_permission({ borrowers => 'edit_borrowers' }) and $loggedinuser != $patron_id ) { | 
            
              | 39 |     print $input->redirect("/cgi-bin/koha/errors/404.pl"); | 
            
              | 40 |  | 
            
              | 41 | } else { | 
            
              | 42 | # patron has permission to edit other borrowers, or is changing their own password | 
            
              | 43 |  | 
        
          | 36 | my $destination  = $input->param('destination'); | 44 | my $destination  = $input->param('destination'); | 
        
          | 37 | my $newpassword  = $input->param('newpassword'); | 45 | my $newpassword  = $input->param('newpassword'); | 
        
          | 38 | my $newpassword2 = $input->param('newpassword2'); | 46 | my $newpassword2 = $input->param('newpassword2'); | 
  
    | Lines 40-46
          my $new_user_id  = $input->param('newuserid');
      
      
        Link Here | 
        
          | 40 |  | 48 |  | 
        
          | 41 | my @errors; | 49 | my @errors; | 
        
          | 42 |  | 50 |  | 
            
              | 43 | my $logged_in_user = Koha::Patrons->find( $loggedinuser ); |  |  | 
        
          | 44 | my $patron = Koha::Patrons->find( $patron_id ); | 51 | my $patron = Koha::Patrons->find( $patron_id ); | 
        
          | 45 | output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); | 52 | output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); | 
        
          | 46 |  | 53 |  | 
  
    | Lines 68-74
          if ( $newpassword and not @errors) {
      
      
        Link Here | 
        
          | 68 |         $patron->userid($new_user_id)->store | 75 |         $patron->userid($new_user_id)->store | 
        
          | 69 |             if $new_user_id and $new_user_id ne $patron->userid; | 76 |             if $new_user_id and $new_user_id ne $patron->userid; | 
        
          | 70 |         $template->param( newpassword => $newpassword ); | 77 |         $template->param( newpassword => $newpassword ); | 
          
            
              | 71 |         if ( $destination eq 'circ' ) { | 78 |         if ( !$patron->has_permission({ borrowers => 'edit_borrowers' }) ) { | 
            
              |  |  | 79 |             print $input->redirect("/cgi-bin/koha/mainpage.pl"); | 
            
              | 80 |         } | 
            
              | 81 |         elsif ( $destination eq 'circ' ) { | 
        
          | 72 |             print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=" . $patron->cardnumber); | 82 |             print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=" . $patron->cardnumber); | 
        
          | 73 |         } | 83 |         } | 
        
          | 74 |         else { | 84 |         else { | 
  
    | Lines 107-110
          if ( scalar(@errors) ) {
      
      
        Link Here | 
        
          | 107 |     } | 117 |     } | 
        
          | 108 | } | 118 | } | 
        
          | 109 |  | 119 |  | 
            
              |  |  | 120 | } # patron has permission to edit other borrowers, or is changing their own password | 
            
              | 121 |  | 
        
          | 110 | output_html_with_http_headers $input, $cookie, $template->output; | 122 | output_html_with_http_headers $input, $cookie, $template->output; | 
            
              | 111 | -  |  |  |