Apache2-Authen-Passphrase

 view release on metacpan or  search on metacpan

lib/Apache2/Authen/Passphrase.pm  view on Meta::CPAN


sub pwset{
	my ($user, $pass)=@_;

	my $file = "$rootdir/$user.yml";
	my $conf = eval { LoadFile $file } // undef;
	$conf->{passphrase}=pwhash $pass;
	$conf->{passphrase_version}=PASSPHRASE_VERSION;
	DumpFile $file, $conf;

	chmod 0660, $file;
}

sub pwcheck{
	my ($user, $pass)=@_;
	die INVALID_USER unless $user =~ USER_REGEX; ## no critic (RequireCarping)
	$user=${^MATCH};                             # Make taint shut up
	my $conf=LoadFile "$rootdir/$user.yml";

	## no critic (RequireCarping)
	die BAD_PASSWORD unless keys %$conf;          # Empty hash means no such user



( run in 0.361 second using v1.01-cache-2.11-cpan-496ff517765 )