[Catalyst] Login via IP address?
Matt S Trout
dbix-class at trout.me.uk
Thu Sep 20 17:10:19 GMT 2007
On Thu, Sep 20, 2007 at 10:20:27AM -0400, Jesse Sheidlower wrote:
>
> I have a Cat app with the usual Session and Authentication
> stuff running, though I'm using my own Authz stuff instead of
> any of the built-in Roles tools. It's a typical setup with
> regular users who can just view things, some users with
> add/edit privs, and superusers who can create new users etc.
>
> In a previous, non-Cat version of this app I had a function so
> that people using the app from the main company location would
> automatically be logged in as a generic "regular" user, and
> only if they tried to do any adding/editing would get
> redirected to a login page. I forgot about this and didn't
> build it into the Cat version, and now I've learned that the
> reason people continue to use the clunky old version instead
> of my shiny fast featureful Cat app is that they're too lazy
> to log in, so I'd like to add this.
>
> The way it looked, more or less, in the old one was:
>
> if ( !defined( $self->login_user() ) ) {
> if ( $ENV{REMOTE_ADDR} =~ m/hairyIPaddressRegEx/ ) {
> $self->login("generic");
> $self->redirect( $self->{target_uri} );
unless ( $c->user_exists ) {
if ( $c->req->address ... )
$c->set_authenticated(...)
> } else {
> # redirect to login page
> }
> }
>
> What's the Right Way to do this in Cat?
>
> Thanks.
>
> Jesse, still not programming much lately
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the Catalyst
mailing list