Cleaning up some things; moar tests
This commit is contained in:
parent
10e7944bc3
commit
45614f4035
|
@ -9,7 +9,7 @@ sub login($self) {
|
|||
|
||||
#Already logged in?
|
||||
return $self->redirect_to('mod_list')
|
||||
if defined $self->session('mod_id');
|
||||
if defined $self->session->{'mod_id'};
|
||||
|
||||
$v = $self->validation if $self->req->method eq 'POST';
|
||||
|
||||
|
@ -30,7 +30,10 @@ sub login($self) {
|
|||
$mod_id = $self->moderator->get_id($email);
|
||||
$mod_name = $self->moderator->get_name($mod_id);
|
||||
|
||||
$self->session(mod_id => $mod_id);
|
||||
$self->session(
|
||||
mod_id => $mod_id,
|
||||
author => $mod_name
|
||||
);
|
||||
$self->flash(info => "Hello, $mod_name 😎");
|
||||
|
||||
return $self->redirect_to('mod_list');
|
||||
|
|
|
@ -35,6 +35,10 @@ subtest Login => sub {
|
|||
->status_is(200)
|
||||
->text_like(h2 => qr/Top Secret/);
|
||||
|
||||
$t->get_ok('/login')
|
||||
->status_is(302)
|
||||
->header_like(Location => qr{moderator/list});
|
||||
|
||||
$t->get_ok('/logout')
|
||||
->status_is(302)
|
||||
->header_like(Location => qr{thread/list});
|
||||
|
|
Loading…
Reference in a new issue