Browse files

example code fixed - when wrong user name

  • Loading branch information...
1 parent f8550f3 commit f85c89360b7334029f65feff5fb52da29ee00a53 Zbigniew Lukasiak committed Dec 2, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/WebNano.pm
View
2 lib/WebNano.pm
@@ -251,7 +251,7 @@ Example code in the application class:
my $req = Plack::Request->new( $env );
if( $req->param( 'username' ) && $req->param( 'password' ) ){
my $user = $self->schema->resultset( 'User' )->search( { username => $req->param( 'username' ) } )->first;
- if( $user->check_password( $req->param( 'password' ) ) ){
+ if( $user && $user->check_password( $req->param( 'password' ) ) ){
$env->{user} = $user;
$env->{'psgix.session'}{user_id} = $user->id;
}

0 comments on commit f85c893

Please sign in to comment.