List Info

Thread: Login via IP address?




Login via IP address?
country flaguser name
United States
2007-09-20 09:20:27
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 =~ m/hairyIPaddressRegEx/ ) {
       $self->login("generic");
       $self->redirect( $self-> );
    } else {
      # redirect to login page
    }
  }

What's the Right Way to do this in Cat?

Thanks.

Jesse, still not programming much lately

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

Re: Login via IP address?
country flaguser name
United Kingdom
2007-09-20 11:10:19
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 =~ m/hairyIPaddressRegEx/ )
{
>        $self->login("generic");
>        $self->redirect( $self-> );

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: Catalystlists.rawmode.org
> Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
> Dev site: http://dev.catalyst.per
l.org/

-- 
      Matt S Trout       Need help with your Catalyst or
DBIx::Class project?
   Technical Director                    http://www.shado
wcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or
deployment platform?
http://chainsawblues.vo
x.com/            http://www.shadow
cat.co.uk/servers/

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )