| 1 | 2 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package Interchange6::Schema::ResultSet::User; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | Interchange6::Schema::ResultSet::User | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =cut | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | Provides extra accessor methods for L<Interchange6::Schema::Result::User> | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =cut | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use parent 'Interchange6::Schema::ResultSet'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =head1 METHODS | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =head2 find_user_with_reset_token( $token ); | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | Where $token is the combined <Interchange6::Schema::Result::User/reset_token> | ||||||||||||||||||||||||||||
| 27 | and <Interchange6::Schema::Result::User/reset_token_checksum> as would be | ||||||||||||||||||||||||||||
| 28 | returned by <Interchange6::Schema::Result::User/reset_token_generate>. | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | Returns an <Interchange6::Schema::Result::User> object if $token is found and | ||||||||||||||||||||||||||||
| 31 | is valid. On failure returns undef. | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | =cut | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | sub find_user_with_reset_token { | ||||||||||||||||||||||||||||
| 36 | 2 | ▶ | my ( $self, $arg ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
find_user_with_reset_token: called CC=5 SCAR=16.8
Pod
documented
| |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 2 | my ( $token, $checksum ) = split(/_/, $arg); | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 2 | ▶ | $self->throw_exception("Bad argument to find_user_with_reset_token") | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$token and $checksum
MC/DC0%0/2
$token and $checksum
$token
$checksum
Truth table33%1/3
A and B
A= $tokenB= $checksum
| |||||||||||||||||||||||||||||
| 41 | unless ( $token && $checksum ); | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 2 | my $users = $self->search({reset_token => $token}); | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 2 | ▶ | while ( my $user = $users->next ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 1 | ▶ | return $user if $user->reset_token_verify( $arg ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 1 | return undef; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 2 | 1; | |||||||||||||||||||||||||||