Move api authentication to under command, add Authentication plugin
This commit is contained in:
parent
f2f2a543fa
commit
998259f0ae
3 changed files with 64 additions and 34 deletions
18
lib/Pear/LocalLoop/Controller/Admin.pm
Normal file
18
lib/Pear/LocalLoop/Controller/Admin.pm
Normal file
|
@ -0,0 +1,18 @@
|
|||
package Pear::LocalLoop::Controller::Admin;
|
||||
use Mojo::Base 'Mojolicious::Controller';
|
||||
|
||||
sub index {
|
||||
my $c = shift;
|
||||
}
|
||||
|
||||
sub under {
|
||||
my $c = shift;
|
||||
|
||||
if ( $c->is_user_authenticated ) {
|
||||
return 1 if defined $c->current_user->administrator;
|
||||
}
|
||||
$c->redirect_to('/');
|
||||
return undef;
|
||||
}
|
||||
|
||||
1;
|
Reference in a new issue