-
-
Save gtsafas/28bd1f125e9b729937c3 to your computer and use it in GitHub Desktop.
validate helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helper validateUser => sub { | |
my ($self,$username,$password) = @_; | |
#Fetch encrypted password from database | |
my $encrypted_password = $self->dbh->selectrow_array("SELECT password FROM users WHERE name=?",undef,$username); | |
#Check if we got any results | |
return 3 if !defined $encrypted_password; | |
#User exists lets validate the password | |
# valid / fail | |
return $self->bcrypt_validate( $password, $encrypted_password ); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment