line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
2366
|
use utf8; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
12
|
|
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
|
|
|
2
|
|
84
|
use strict; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
132
|
|
18
|
2
|
|
|
2
|
|
16
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
19
|
2
|
|
|
2
|
|
15
|
use mro 'c3'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
11
|
|
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
2
|
|
65
|
use parent 'Interchange6::Schema::ResultSet'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
13
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 METHODS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 find |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Override L<DBIx::Class::ResultSet/find> for lookup of |
28
|
|
|
|
|
|
|
L<Interchange6::Schema::Result::User/username> so that leading/trailing spaces |
29
|
|
|
|
|
|
|
are stripped from username and it is also lower-cased. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub find { |
34
|
30
|
|
|
30
|
1
|
401829
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
30
|
100
|
100
|
|
|
346
|
if ( ref( $_[0] ) eq 'HASH' && defined $_[0]->{username} ) { |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# looking for a username |
39
|
26
|
|
|
|
|
120
|
$_[0]->{username} = lc( $_[0]->{username} ); |
40
|
26
|
|
|
|
|
167
|
$_[0]->{username} =~ s/(^\s+|\s+$)//g; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
30
|
|
|
|
|
171
|
$self->next::method(@_); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 find_user_with_reset_token( $token ); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Where $token is the combined <Interchange6::Schema::Result::User/reset_token> |
49
|
|
|
|
|
|
|
and <Interchange6::Schema::Result::User/reset_token_checksum> as would be |
50
|
|
|
|
|
|
|
returned by <Interchange6::Schema::Result::User/reset_token_generate>. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Returns an <Interchange6::Schema::Result::User> object if $token is found and |
53
|
|
|
|
|
|
|
is valid. On failure returns undef. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub find_user_with_reset_token { |
58
|
10
|
|
|
10
|
1
|
19636
|
my ( $self, $arg ) = @_; |
59
|
|
|
|
|
|
|
|
60
|
10
|
100
|
|
|
|
45
|
$self->throw_exception("Bad argument to find_user_with_reset_token") |
61
|
|
|
|
|
|
|
unless $arg; |
62
|
|
|
|
|
|
|
|
63
|
9
|
|
|
|
|
41
|
my ( $token, $checksum ) = split(/_/, $arg); |
64
|
|
|
|
|
|
|
|
65
|
9
|
100
|
100
|
|
|
144
|
$self->throw_exception("Bad argument to find_user_with_reset_token") |
66
|
|
|
|
|
|
|
unless ( $token && $checksum ); |
67
|
|
|
|
|
|
|
|
68
|
5
|
|
|
|
|
38
|
my $users = $self->search({reset_token => $token}); |
69
|
|
|
|
|
|
|
|
70
|
5
|
|
|
|
|
1393
|
while ( my $user = $users->next ) { |
71
|
4
|
100
|
|
|
|
14440
|
return $user if $user->reset_token_verify( $arg ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
3
|
|
|
|
|
3959
|
return undef; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |