@@ -1,3 +1,9 @@
+2.0.6 2014-12-16
+
+ [ AUTO STRINGIFICATION IS DEPRECATED ]
+This version brings back the overloading but it will carp!
+You must use $phrase->rfc2307() to get a text string.
+
2.0.5 2014-12-12
[ Sawyer X ]
@@ -17,7 +17,6 @@ t/006_return_object.t
t/007_no_salt.t
t/008_unicode_matching.t
t/009_exception_handling.t
-t/010_auto_stringification.t
t/011_alternative_bcrypt.t
t/013_hashes_generated_elsewhere.t
META.yml Module YAML meta-data (added by MakeMaker)
@@ -52,5 +52,5 @@
"url" : "https://github.com/hvoers/Dancer2-Plugin-Passphrase"
}
},
- "version" : "v2.0.5"
+ "version" : "v2.0.6"
}
@@ -29,4 +29,4 @@ resources:
bugtracker: https://github.com/hvoers/Dancer2-Plugin-Passphrase/issues
homepage: https://github.com/hvoers/Dancer2-Plugin-Passphrase/
repository: https://github.com/hvoers/Dancer2-Plugin-Passphrase
-version: v2.0.5
+version: v2.0.6
@@ -182,9 +182,6 @@ sub generate_random {
sub matches {
my ($self, $stored_hash) = @_;
- # Force auto stringification in case we were passed an object.
- ($stored_hash) = ($stored_hash =~ m/(.*)/s);
-
my $settings = $self->_extract_settings($stored_hash);
my $new_hash = $self->_calculate_hash($settings)->rfc2307;
@@ -1,8 +1,19 @@
package Dancer2::Plugin::Passphrase::Hashed;
use strict;
use warnings;
+use Carp qw(carp);
use MIME::Base64 qw(encode_base64);
+use overload (
+ '""' => sub {
+ if (blessed($_[0]) && $_[0]->isa('Dancer2::Plugin::Passphrase::Hashed')) {
+ carp 'Auto stringification is deprecated. Use ->rfc2307()';
+ $_[0]->rfc2307();
+ }
+ },
+ fallback => 1,
+);
+
sub new {
my $class = shift;
my @args = @_;
@@ -7,7 +7,7 @@ use Dancer2::Plugin;
use Dancer2::Plugin::Passphrase::Core;
use Dancer2::Plugin::Passphrase::Hashed;
-our $VERSION = '2.0.5';
+our $VERSION = '2.0.6';
register passphrase => \&passphrase;
@@ -60,6 +60,11 @@ This package does no checking about how secure the password is,
minimum length or anything, including a length of 0 being valid.
You can add extra checks in your "MyWebService".
+=head1 AUTO STRINGIFICATION IS DEPRECATED
+
+This version brings back the overloading but it will carp!
+You must use $phrase->rfc2307() to get a text string.
+
=head1 KEYWORDS
=head2 passphrase
@@ -96,11 +101,9 @@ __END__
Generates an RFC 2307 representation of the hashed passphrase
that is suitable for storage in a database.
- my $pass = passphrase('my passphrase')->generate;
+ my $phrase = passphrase('my passphrase')->generate;
-You should store C<$phrase->rfc_2307()> in your database. For convenience
-the object will automagically return the RFC 2307 representation when no
-method is called on it.
+You should store C<$phrase->rfc_2307()> in your database.
Accepts a hashref of options to specify what kind of hash should be
generated. All options settable in the config file are valid.
@@ -1,16 +0,0 @@
-use Test::More tests => 1;
-
-use strict;
-use warnings;
-
-use Dancer2;
-use Dancer2::Plugin::Passphrase;
-
-my $secret = "Super Secret Squirrel";
-
-my $rfc2307 = passphrase($secret)->generate;
-
-
-eval { passphrase($secret)->matches($rfc2307) };
-unlike $@, qr/Operation "eq": no method found/i, 'Auto stringifies passphrase object';
-