| 1 | package WWW::Picnic::Result::Login; | ||||||||||||||||||||||||||||
| 2 | 2 | our $VERSION = '0.100'; | |||||||||||||||||||||||||||
| 3 | 2 | our $AUTHORITY = 'cpan:GETTY'; | |||||||||||||||||||||||||||
| 4 | # ABSTRACT: Picnic login result with 2FA status | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | extends 'WWW::Picnic::Result'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | has auth_key => ( | ||||||||||||||||||||||||||||
| 12 | is => 'ro', | ||||||||||||||||||||||||||||
| 13 | lazy => 1, | ||||||||||||||||||||||||||||
| 14 | 1 | ▶ | default => sub { shift->_get('auth_key') }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 2 | ); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | has user_id => ( | ||||||||||||||||||||||||||||
| 19 | is => 'ro', | ||||||||||||||||||||||||||||
| 20 | lazy => 1, | ||||||||||||||||||||||||||||
| 21 | 1 | ▶ | default => sub { shift->_get('user_id') }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 2 | ); | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | has second_factor_authentication_required => ( | ||||||||||||||||||||||||||||
| 26 | is => 'ro', | ||||||||||||||||||||||||||||
| 27 | lazy => 1, | ||||||||||||||||||||||||||||
| 28 | 1 | ▶ | default => sub { shift->_get('second_factor_authentication_required') || 0 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 2 | ); | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | has show_second_factor_authentication_intro => ( | ||||||||||||||||||||||||||||
| 33 | is => 'ro', | ||||||||||||||||||||||||||||
| 34 | lazy => 1, | ||||||||||||||||||||||||||||
| 35 | 0 | ▶ | default => sub { shift->_get('show_second_factor_authentication_intro') || 0 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 2 | ); | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | sub requires_2fa { | ||||||||||||||||||||||||||||
| 40 | 2 | ▶ | my ( $self ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
requires_2fa: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||
| 41 | 2 | ▶ | return $self->second_factor_authentication_required ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | sub is_authenticated { | ||||||||||||||||||||||||||||
| 46 | 1 | ▶ | my ( $self ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
is_authenticated: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | 1 | ▶ | return $self->auth_key && !$self->requires_2fa ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->auth_key and not $self->requires_2fa
MC/DC0%0/2
$self->auth_key and not $self->requires_2fa
$self->auth_key
not $self->requires_2fa
Truth table33%1/3
A and not(B)
A= $self->auth_keyB= not $self->requires_2fa
| |||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 2 | 1; | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | __END__ | ||||||||||||||||||||||||||||