| 1 | package Wishlist::Controller::Access; | ||||||||||
| 2 | 2 | ▶ | use Mojo::Base 'Mojolicious::Controller'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 0 | ▶ | sub login { | ||||||||
|
Subroutine
login: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 5 | 0 | my $c = shift; | |||||||||
| 6 | 0 | my $username = $c->param('username'); | |||||||||
| 7 | 0 | my $password = $c->param('password'); | |||||||||
| 8 | 0 | ▶ | if ($c->model->check_password($username, $password)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 9 | 0 | $c->session->{username} = $username; | |||||||||
| 10 | } | ||||||||||
| 11 | 0 | $c->redirect_to('/'); | |||||||||
| 12 | } | ||||||||||
| 13 | |||||||||||
| 14 | 0 | ▶ | sub register { | ||||||||
|
Subroutine
register: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 15 | 0 | my $c = shift; | |||||||||
| 16 | 0 | my $username = $c->param('username'); | |||||||||
| 17 | 0 | my $user = { | |||||||||
| 18 | username => $username, | ||||||||||
| 19 | password => $c->param('password'), | ||||||||||
| 20 | name => $c->param('name'), | ||||||||||
| 21 | }; | ||||||||||
| 22 | 0 | warn Mojo::Util::dumper $user; | |||||||||
| 23 | 0 | ▶ | unless(eval { $c->model->add_user($user); 1 }) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | ▶ | $c->app->log->error($@) if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 0 | return $c->render(text => 'Could not create user', status => 400); | |||||||||
| 26 | } | ||||||||||
| 27 | 0 | $c->session->{username} = $username; | |||||||||
| 28 | 0 | $c->redirect_to('/'); | |||||||||
| 29 | }; | ||||||||||
| 30 | |||||||||||
| 31 | 0 | ▶ | sub logout { | ||||||||
|
Subroutine
logout: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 32 | 0 | my $c = shift; | |||||||||
| 33 | 0 | $c->session(expires => 1); | |||||||||
| 34 | 0 | $c->redirect_to('/'); | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 2 | 1; | |||||||||
| 38 | |||||||||||