[Catalyst] C::P::Authentication, force user authentication

Ben van Staveren benvanstaveren at gmail.com
Mon Dec 28 09:16:05 GMT 2009


It's a hack but it works... in a way. If you are using DBIx::Class, you 
can load the user record:

my $user = $c->model('YourUserModel')->find(userid);
$c->session->{__user} = { $user->get_columns };

As far as C::P::Authentication is concerned, the user is now 
authenticated. Forgot whether the key is __user or __user__ but just 
warn Dumper($c->session) at some point to see what it's supposed to be.

Warning: I use this myself, it seems to work, but it's a hack. YMMV. 
Standard disclaimer applies.

David Schmidt wrote:
> Hello
> 
> When a user lost his password I send a digest by email.
> If he enters this digest I want to automatically authenticate the user
> so he can edit his password.
> 
> I only found this method but it says in the docs you shouldn't use it
> in your code as it is an internal function only.
> $c->set_authenticated( $user, $realmname )
> 
> Any other way to force user authentication?
> 
> thanks
> 
> david
> 
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
> 



More information about the Catalyst mailing list