Skip to content

Instantly share code, notes, and snippets.

Created January 24, 2011 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/793247 to your computer and use it in GitHub Desktop.
Save anonymous/793247 to your computer and use it in GitHub Desktop.
sub startup {
my $mojo = shift;
my $r = $mojo->routes;
$mojo->secret('m7ucxtbswubgzstrbzju');
my $auth = $r->bridge->to(
cb => sub {
if (0) { # 'authenticated'
return 1;
} else {
return 0;
};
});
$auth->route('/')->to(cb => sub { shift->redirect_to('/profile')});
$auth->route('/login')->to(cb => sub {shift->render_text('Log in: ...')});
$auth->route('/profile')->to(cb => sub {shift->render_text('Your profile page!')});
$r->route->to(cb => sub { shift->render_text('You have to log in!')});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment