line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AproJo::User; |
2
|
2
|
|
|
2
|
|
169283
|
use Mojo::Base 'Mojolicious::Controller'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
9
|
|
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
347
|
use Data::Dumper; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
484
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub login { |
7
|
3
|
|
|
3
|
0
|
57389
|
my $self = shift; |
8
|
3
|
|
|
|
|
15
|
my $name = $self->param('username'); |
9
|
3
|
|
|
|
|
994
|
my $pass = $self->param('password'); |
10
|
3
|
|
|
|
|
123
|
my $from = $self->param('from'); |
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
|
|
114
|
my $schema = $self->schema; |
13
|
|
|
|
|
|
|
|
14
|
3
|
|
|
|
|
46
|
my $user = $schema->resultset('User')->single({name => $name}); |
15
|
|
|
|
|
|
|
|
16
|
3
|
100
|
100
|
|
|
7125
|
if ($user and $user->password eq $pass) { |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
91
|
$self->session->{id} = $user->user_id; |
19
|
1
|
|
|
|
|
342
|
$self->session->{username} = $name; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
else { |
23
|
2
|
|
|
|
|
116
|
$self->flash(onload_message => "Sorry try again"); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#$self->redirect_to( $from ); |
27
|
3
|
|
|
|
|
544
|
$self->redirect_to("/"); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub logout { |
31
|
1
|
|
|
1
|
0
|
83082
|
my $self = shift; |
32
|
1
|
|
|
|
|
5
|
$self->session(expires => 1); |
33
|
1
|
|
|
|
|
393
|
$self->redirect_to($self->home_page); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|