Skip to content

Commit

Permalink
user login: the controller (handling form submission)
Browse files Browse the repository at this point in the history
  • Loading branch information
garu committed Jun 13, 2010
1 parent f73b8f2 commit 7035cf7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tweetylicious.pl
Expand Up @@ -96,6 +96,18 @@ package main;

# user login
get '/login' => 'login';
post '/login' => sub {
my $self = shift;
my $user = $self->param('username') || '';

if ( Model::User->count( 'WHERE username=? AND password=?',
$user, b(app->secret . $self->param('password'))->md5_sum) == 1
) {
$self->session( name => $user );
return $self->redirect_to("/");
}
$self->stash( error => 1 );
} => 'login';


# let's rock and roll!
Expand Down

0 comments on commit 7035cf7

Please sign in to comment.