From 123d9b5b509ffc53c3d192780b5bed50adbc0c52 Mon Sep 17 00:00:00 2001 From: Adirelle Date: Mon, 14 Nov 2011 11:33:41 +0100 Subject: [PATCH] Small query tweaks. --- Redmine.pm | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Redmine.pm b/Redmine.pm index 348e2ef..4e5e402 100644 --- a/Redmine.pm +++ b/Redmine.pm @@ -359,10 +359,8 @@ sub check_login { my ($r, $dbh, $password) = @_; my $user = $r->user; - my ($hashed_password, $status, $auth_source_id, $salt) = $dbh->selectrow_array('SELECT hashed_password, status, auth_source_id, salt FROM users WHERE login = ?', undef, $user); - - # Not found - return (AUTH_REQUIRED, "unknown user '$user'") unless defined($hashed_password); + my ($hashed_password, $status, $auth_source_id, $salt) = $dbh->selectrow_array('SELECT hashed_password, status, auth_source_id, salt FROM users WHERE login = ?', undef, $user) + or return (AUTH_REQUIRED, "unknown user '$user'"); # Check password if($auth_source_id) { @@ -377,11 +375,8 @@ sub check_login { "SELECT host,port,tls,account,account_password,base_dn,attr_login from auth_sources WHERE id = ?", undef, $auth_source_id - ); - - # Check them - return (SERVER_ERROR, "Undefined authentication source for '$user'") - unless defined $host; + ) + or return (SERVER_ERROR, "Undefined authentication source for '$user'"); # Connect to the LDAP server my $ldap = Authen::Simple::LDAP->new(