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