Lines 29-34
use Digest::MD5 qw(md5_base64);
Link Here
|
29 |
use C4::Circulation; |
29 |
use C4::Circulation; |
30 |
use C4::Members; |
30 |
use C4::Members; |
31 |
use C4::Output; |
31 |
use C4::Output; |
|
|
32 |
use C4::Auth qw(hash_password); |
32 |
|
33 |
|
33 |
my $query = new CGI; |
34 |
my $query = new CGI; |
34 |
my $dbh = C4::Context->dbh; |
35 |
my $dbh = C4::Context->dbh; |
Lines 57-63
if ( C4::Context->preference("OpacPasswordChange") ) {
Link Here
|
57 |
if ( $query->param('Newkey') eq $query->param('Confirm') |
58 |
if ( $query->param('Newkey') eq $query->param('Confirm') |
58 |
&& length( $query->param('Confirm') ) >= $minpasslen ) |
59 |
&& length( $query->param('Confirm') ) >= $minpasslen ) |
59 |
{ # Record password |
60 |
{ # Record password |
60 |
my $clave = md5_base64( $query->param('Newkey') ); |
61 |
my $clave = hash_password( $query->param('Newkey') ); |
61 |
$sth->execute( $clave, $borrowernumber ); |
62 |
$sth->execute( $clave, $borrowernumber ); |
62 |
$template->param( 'password_updated' => '1' ); |
63 |
$template->param( 'password_updated' => '1' ); |
63 |
$template->param( 'borrowernumber' => $borrowernumber ); |
64 |
$template->param( 'borrowernumber' => $borrowernumber ); |
Lines 113-120
sub goodkey {
Link Here
|
113 |
$dbh->prepare("SELECT password FROM borrowers WHERE borrowernumber=?"); |
114 |
$dbh->prepare("SELECT password FROM borrowers WHERE borrowernumber=?"); |
114 |
$sth->execute($borrowernumber); |
115 |
$sth->execute($borrowernumber); |
115 |
if ( $sth->rows ) { |
116 |
if ( $sth->rows ) { |
116 |
my ($md5password) = $sth->fetchrow; |
117 |
my $hash; |
117 |
if ( md5_base64($key) eq $md5password ) { return 1; } |
118 |
my ($stored_hash) = $sth->fetchrow; |
|
|
119 |
if ( substr($stored_hash,0,2) eq '$2') { |
120 |
$hash = hash_password($key, $stored_hash); |
121 |
} else { |
122 |
$hash = md5_base64($key); |
123 |
} |
124 |
if ( $hash eq $stored_hash ) { return 1; } |
118 |
else { return 0; } |
125 |
else { return 0; } |
119 |
} |
126 |
} |
120 |
else { return 0; } |
127 |
else { return 0; } |
121 |
- |
|
|