summaryrefslogtreecommitdiff
path: root/index.pl
diff options
context:
space:
mode:
Diffstat (limited to 'index.pl')
-rwxr-xr-xindex.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/index.pl b/index.pl
index 4b5bc9b..5a7e598 100755
--- a/index.pl
+++ b/index.pl
@@ -1,6 +1,7 @@
#!/usr/bin/env perl
use Mojolicious::Lite;
+use Mojolicious::Plugin::Authentication;
use Cache::File;
use DateTime;
use DBI;
@@ -33,6 +34,27 @@ my %action_type = (
undo => 3,
);
+app->plugin(authentication => {
+ autoload_user => 1,
+ session_key => 'foodor',
+ load_user => sub {
+ my ($app, $uid) = @_;
+ if ($uid == 1) {
+ return {
+ name => 'derf',
+ };
+ }
+ return undef;
+ },
+ validate_user => sub {
+ my ($c, $username, $password, $extradata) = @_;
+ if ($username eq 'derf' and $password eq 'hallo') {
+ return 1;
+ }
+ return undef;
+ },
+});
+
app->defaults( layout => 'default' );
app->attr(
@@ -772,6 +794,16 @@ post '/x/geolocation' => sub {
};
+get '/x/login' => sub {
+ my ($self) = @_;
+ $self->render('login');
+};
+
+get '/x/register' => sub {
+ my ($self) = @_;
+ $self->render('register');
+};
+
get '/*station' => sub {
my ($self) = @_;
my $station = $self->stash('station');