| Rubric documentation | Contained in the Rubric distribution. |
Rubric::WebApp::Login::Post - process web login from query parameters
version 0.147
This module checks the submitted query for information needed to confirm that a user is logged into the Rubric.
This checks for the username in a current login request. First it checks
whether there is a current_user value in this session. If not, it looks for
a user query parameter.
This returns true if the username came from the session. Otherwise, it checks
for a password query parameter and compares its md5sum against the user's
stored password md5sum.
This method sets the current user in the session and then calls the superclass
set_current_user.
Ricardo SIGNES, <rjbs@cpan.org>
Please report any bugs or feature requests to bug-rubric@rt.cpan.org, or
through the web interface at http://rt.cpan.org. I will be notified, and
then you'll automatically be notified of progress on your bug as I make
changes.
Copyright 2004 Ricardo SIGNES. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Rubric documentation | Contained in the Rubric distribution. |
use strict; use warnings; package Rubric::WebApp::Login::Post; use base qw(Rubric::WebApp::Login); use Digest::MD5 qw(md5_hex);
our $VERSION = '0.147';
sub get_login_username { my ($class, $webapp) = @_; $webapp->session->param('current_user') || $webapp->query->param('user'); }
sub authenticate_login { my ($self, $webapp, $user) = @_; return 1 if $webapp->session->param('current_user') and $webapp->session->param('current_user') eq $user; my $password = $webapp->query->param('password'); return (md5_hex($password) eq $user->password); }
sub set_current_user { my ($self, $webapp, $user) = @_; $webapp->session->param(current_user => $user->username); $self->SUPER::set_current_user($webapp, $user); }
1;