# HG changeset patch # User Bill Welliver # Date 1204062592 0 # Tue Feb 26 21:49:52 2008 +0000 # Node ID d2221eefcab5959be5dd547b35e6ec9a4a01872c # Parent b3019225afbc573437ec3de1fe9172b5d7e0369a some more detailsy diff --git a/auth/README b/auth/README --- a/auth/README +++ b/auth/README @@ -1,2 +1,26 @@ This is a Fins controller and set of templates for providing user authentication in an application. + +To make an entire controller accessible by authenticated users only, +you'd add the following to your controller: + +static void start() +{ + before_filter(app->admin_user_filter); +} + +Where admin_user_filter is a method that looks like: + + +int admin_user_filter(Fins.Request id, Fins.Response response, mixed ... args) +{ + if(!id->misc->session_variables->user) + { + response->flash("msg", "You must login to perform this action."); + response->redirect(app->controller->auth->login, 0, ([ "return_to": id->not_query ])); + return 0; + } + + return 1; +} +