svn commit: r264557 - user/des/fbp/lib/FBP
Dag-Erling Smørgrav
des at FreeBSD.org
Wed Apr 16 21:10:37 UTC 2014
Author: des
Date: Wed Apr 16 21:10:36 2014
New Revision: 264557
URL: http://svnweb.freebsd.org/changeset/base/264557
Log:
(and the rest of the controller)
Added:
user/des/fbp/lib/FBP/Controller.pm (contents, props changed)
Added: user/des/fbp/lib/FBP/Controller.pm
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/des/fbp/lib/FBP/Controller.pm Wed Apr 16 21:10:36 2014 (r264557)
@@ -0,0 +1,52 @@
+use utf8;
+package FBP::Controller;
+use Moose;
+use namespace::autoclean;
+
+BEGIN { extends 'Catalyst::Controller'; }
+
+=encoding utf8
+
+=head1 NAME
+
+FBP::Controller - Superclass for FBP controllers
+
+=head1 DESCRIPTION
+
+This class provides common code for FBP controllers.
+
+=head1 METHODS
+
+=head2 require_user
+
+Verifies that the client is authenticated, and if not, redirects to
+the login page.
+
+=cut
+
+sub require_user($$) {
+ my ($self, $c) = @_;
+
+ if (!$c->user_exists) {
+ $c->response->redirect($c->uri_for_action('/login'));
+ $c->detach();
+ }
+ return $c->user;
+}
+
+=head1 AUTHOR
+
+Dag-Erling Smørgrav <des at freebsd.org>
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
+
+1;
+
+# $FreeBSD$
More information about the svn-src-user
mailing list