blib/lib/Lemonldap/NG/Portal/Password/DBI.pm

filter: Statementstmt 88.2% 30 / 34 Branchbran 40.0% 4 / 10 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 3 totaltotal 73.2% 41 / 56 CC 7 SCAR 15.0
CC
7
Cov
76%
modifyPassword
7.6
init
2.1
BEGIN
1.0
CRAP 4.5
« blib/lib/Lemonldap/NG/Portal/Auth/Slave.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/Lib/Okta.pm »
1 package Lemonldap::NG::Portal::Password::DBI;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Lemonldap::NG::Portal::Main::Constants qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
6 PE_ERROR
7 PE_PASSWORD_OK
8 1 );
9  
10 1 extends qw(
11 Lemonldap::NG::Portal::Lib::DBI
12 Lemonldap::NG::Portal::Password::Base
13  
14 );
15  
16 1 our $VERSION = '2.0.16';
17  
18 4 ▶sub init {
Subroutine init: called CC=2 SCAR=7.2
Pod undocumented
19 4 my ($self) = @_;
20 4 ▶ $self->Lemonldap::NG::Portal::Password::Base::init
Branch: 1 branch
BranchTrueFalseTotal
$self->Lemonldap::NG::Portal::Password::Base::init and $self->Lemonldap::NG::Portal::Lib::DBI::init 4 0 4
21 and $self->Lemonldap::NG::Portal::Lib::DBI::init;
22 }
23  
24 2 ▶sub confirm {
Subroutine confirm: called CC=1 SCAR=0.0
Pod undocumented
25 2 my ( $self, $req, $pwd ) = @_;
26 2 return $self->check_password( $req, $pwd );
27 }
28  
29 2 ▶sub modifyPassword {
Subroutine modifyPassword: called CC=6 SCAR=20.3
Pod undocumented
30 2 my ( $self, $req, $pwd, %args ) = @_;
31 2 ▶ my $userCol = $args{useMail} ? $self->mailField : $self->pivot;
Branch: 1 branch
BranchTrueFalseTotal
$args{'useMail'} ? : 0 2 2
32 2 my $passwordCol = $self->conf->{dbiAuthPasswordCol};
33 2 my $table = $self->conf->{dbiAuthTable};
34 2 ▶ my $dynamicHash = $self->conf->{dbiDynamicHashEnabled} || 0;
Condition50%1/2
$self->conf->{'dbiDynamicHashEnabled'} || 0
l!l
02
MC/DC0%0/1
$self->conf->{'dbiDynamicHashEnabled'} || 0
$self->conf->{'dbiDynamicHashEnabled'}
Truth table50%1/2
A
A= $self->conf->{'dbiDynamicHashEnabled'}
Aresult
11
00
35 2 my $passwordsql;
36 my $stored_value;
37  
38 2 ▶ if ( $dynamicHash == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dynamicHash == 1) { } 0 2 2
39  
40 0 $passwordsql = "?";
41  
42 # Dynamic password hashes
43 0 $stored_value =
44 $self->get_dynamic_hash_new_password( $req, $self->dbh, $req->user,
45 $pwd, $table, $userCol, $passwordCol );
46 }
47 else {
48 # Static Password hash
49 $passwordsql =
50 2 $self->hash_password( "?", $self->conf->{dbiAuthPasswordHash} );
51 2 $stored_value = $pwd;
52 }
53  
54 2 eval {
55 2 my $sth = $self->dbh->prepare(
56 "UPDATE $table SET $passwordCol=$passwordsql WHERE $userCol=?");
57 2 $sth->execute( $stored_value, $req->user );
58 };
59 2 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 2 2
60  
61 # If connection isn't available, error is displayed by dbh()
62 0 ▶ $self->logger->error("DBI password modification error: $@")
Branch: 1 branch
BranchTrueFalseTotal
if $self->_dbh 0 0 0
63 if ( $self->_dbh );
64 0 return PE_ERROR;
65 }
66 else {
67 2 return PE_PASSWORD_OK;
68 }
69 }
70  
71 1 1;
« blib/lib/Lemonldap/NG/Portal/Auth/Slave.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/Lib/Okta.pm »