This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Foodloop-Server/lib/Pear/LocalLoop/Controller/Root.pm

55 lines
805 B
Perl
Raw Normal View History

package Pear::LocalLoop::Controller::Root;
use Mojo::Base 'Mojolicious::Controller';
2021-03-20 19:03:59 +00:00
## no critic (Subroutines::ProhibitBuiltinHomonyms)
sub index {
2021-03-20 19:03:59 +00:00
## use critic
2021-03-20 12:09:50 +00:00
my $c = shift;
2021-03-20 12:09:50 +00:00
# if ( $c->is_user_authenticated ) {
# $c->redirect_to('/home');
# }
2021-03-20 15:02:00 +00:00
return 1;
}
sub under {
2021-03-20 12:09:50 +00:00
my $c = shift;
2021-03-20 12:09:50 +00:00
if ( $c->is_user_authenticated ) {
return 1;
}
$c->redirect_to('/');
return;
}
sub auth_login {
2021-03-20 12:09:50 +00:00
my $c = shift;
if ( $c->authenticate( $c->param('email'), $c->param('password') ) ) {
$c->redirect_to('/home');
}
else {
$c->redirect_to('/');
}
2021-03-20 15:02:00 +00:00
return 1;
}
2017-04-08 12:38:54 +00:00
sub auth_logout {
2021-03-20 12:09:50 +00:00
my $c = shift;
2017-04-08 12:38:54 +00:00
2021-03-20 12:09:50 +00:00
$c->logout;
$c->redirect_to('/');
2021-03-20 15:02:00 +00:00
return 1;
2017-04-08 12:38:54 +00:00
}
sub home {
2021-03-20 12:09:50 +00:00
my $c = shift;
2021-03-20 15:02:00 +00:00
return 1;
}
2017-04-08 12:38:54 +00:00
1;