lib/Reaction/InterfaceModel/Action/User/ChangePassword.pm

filter: Statementstmt 55.5% 15 / 27 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 100% 1 / 1 totaltotal 43.1% 19 / 44 CC 6 SCAR 20.7
CC
6
Cov
41%
__ANON__
12.0
verify_old_password
12.0
__ANON__
6.0
CRAP 7.9
« lib/Reaction/UI/ViewPort/Field/Role/Mutable/Simple.pm ↑ Summary lib/Reaction/UI/Controller.pm »
1 package Reaction::InterfaceModel::Action::User::ChangePassword;
2  
3 1 ▶use Reaction::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Reaction::Types::Core qw(Password);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use namespace::clean -except => [ qw(meta) ];
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 extends 'Reaction::InterfaceModel::Action::User::SetPassword';
9  
10  
11 1 has old_password => (isa => Password, is => 'rw', lazy_fail => 1);
12  
13 0 ▶around error_for_attribute => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
14 0 my $super = shift;
15 0 my ($self, $attr) = @_;
16 0 ▶ if ($attr->name eq 'old_password') {
Branch: 1 branch
BranchTrueFalseTotal
if ($attr->name eq "old_password") 0 0 0
17 0 ▶ return "Old password incorrect"
Branch: 1 branch
BranchTrueFalseTotal
unless $self->verify_old_password 0 0 0
18 unless $self->verify_old_password;
19 }
20 #return $super->(@_); #commented out because the original didn't super()
21 1 };
22  
23 0 ▶around can_apply => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
24 0 my $super = shift;
25 0 my ($self) = @_;
26 0 ▶ return 0 unless $self->verify_old_password;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->verify_old_password 0 0 0
27 0 return $super->(@_);
28 1 };
29 0 ▶sub verify_old_password {
Subroutine verify_old_password: not called CC=3 SCAR=24.8
Pod documented
30 0 my $self = shift;
31 0 ▶ return unless $self->has_old_password;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_old_password 0 0 0
32
33 0 my $user = $self->target_model;
34 0 ▶ return $user->can("check_password") ?
Branch: 1 branch
BranchTrueFalseTotal
$user->can('check_password') ? : 0 0 0
35 $user->check_password($self->old_password) :
36 $self->old_password eq $user->password;
37 };
38  
39 1 __PACKAGE__->meta->make_immutable;
40  
41  
42 1 1;
43  
44 =head1 NAME
45  
46 Reaction::InterfaceModel::Action::User::ChangePassword
47  
48 =head1 DESCRIPTION
49  
50 =head1 METHODS
51  
52 =head2 old_password
53  
54 =head2 verify_old_password
55  
56 =head1 SEE ALSO
57  
58 L<Reaction::InterfaceModel::Action::DBIC::User::ChangePassword>
59  
60 =head1 AUTHORS
61  
62 See L<Reaction::Class> for authors.
63  
64 =head1 LICENSE
65  
66 See L<Reaction::Class> for the license.
67  
68 =cut
« lib/Reaction/UI/ViewPort/Field/Role/Mutable/Simple.pm ↑ Summary lib/Reaction/UI/Controller.pm »