[Catalyst] Preventing simultaneous logins
Matt S Trout
dbix-class at trout.me.uk
Thu Jul 24 03:35:47 BST 2008
On Wed, Jul 23, 2008 at 09:47:57PM +0200, Daniel McBrearty wrote:
> I'm using Cat with a pretty standard configuration of :
>
> Catalyst::Plugin::Authentication
> Catalyst::Plugin::Session
> Catalyst::Plugin::Session::State::Cookie
> Catalyst::Plugin::Session::Store::FastMmap
>
> to handle login and session management. My login code looks like this:
>
> my $u = $params->{username};
>
> if ($c->authenticate( { username => $u,
> password => $params->{'password'}
> } )){
> my $user = $c->user;
> $user->last_login(DateTime->now);
> $user->update();
> $c->response->redirect( $forward, 301);
>
> } else {
> # login failed
> $c->stash->{login_failed} = 1;
> }
>
>
> What I'd like to do is check if this user is already logged in at some
> other computer, and deny access if so. I guess that means :
>
> 1. checking whether there is an existing session associated this username
Session::PerUser ?
> 2. Being sure that the associated session is cleared when the user hits 'logout'
after logout => { shift->delete_session };
--
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