diff options
author | wreis <wreis@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-10-29 23:27:53 +0000 |
---|---|---|
committer | wreis <wreis@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-10-29 23:27:53 +0000 |
commit | bf0540d7013ab5330cbad4ad2ec1abfd34ce32aa (patch) | |
tree | 8a797f29711e1015cbed5f1b63ffbcf10e17a24c /lib/Reaction/InterfaceModel | |
parent | b28ccff3af21303d96abb6fdd0c81538824cee1e (diff) | |
download | reaction-bf0540d7013ab5330cbad4ad2ec1abfd34ce32aa.tar.gz reaction-bf0540d7013ab5330cbad4ad2ec1abfd34ce32aa.zip |
new confirmation_code role
Diffstat (limited to 'lib/Reaction/InterfaceModel')
-rw-r--r-- | lib/Reaction/InterfaceModel/Action/User/Role/ConfirmationCodeSupport.pm | 44 | ||||
-rw-r--r-- | lib/Reaction/InterfaceModel/Object/User/Role/ConfirmationCodeSupport.pm | 17 |
2 files changed, 17 insertions, 44 deletions
diff --git a/lib/Reaction/InterfaceModel/Action/User/Role/ConfirmationCodeSupport.pm b/lib/Reaction/InterfaceModel/Action/User/Role/ConfirmationCodeSupport.pm deleted file mode 100644 index 1b85d26..0000000 --- a/lib/Reaction/InterfaceModel/Action/User/Role/ConfirmationCodeSupport.pm +++ /dev/null @@ -1,44 +0,0 @@ -package Reaction::InterfaceModel::Action::User::Role::ConfirmationCodeSupport; - -use Reaction::Role; -use Digest::MD5; - -use namespace::clean -except => [ qw(meta) ]; - - -#requires qw/target_model ctx/; -sub generate_confirmation_code { - my $self = shift; - my $ident = $self->target_model->identity_string. - $self->target_model->password; - my $secret = $self->ctx->config->{confirmation_code_secret}; - die "Application config does not define confirmation_code_secret" - unless $secret; - return Digest::MD5::md5_hex($secret.$ident); -}; - - - -1; - -=head1 NAME - -Reaction::InterfaceModel::Action::User::Role::ConfirmationCodeSupport - -=head1 DESCRIPTION - -=head2 generate_confirmation_code - -=head2 meta - -Need to define confirmation_code_secret in application config. - -=head1 AUTHORS - -See L<Reaction::Class> for authors. - -=head1 LICENSE - -See L<Reaction::Class> for the license. - -=cut diff --git a/lib/Reaction/InterfaceModel/Object/User/Role/ConfirmationCodeSupport.pm b/lib/Reaction/InterfaceModel/Object/User/Role/ConfirmationCodeSupport.pm new file mode 100644 index 0000000..bf79eef --- /dev/null +++ b/lib/Reaction/InterfaceModel/Object/User/Role/ConfirmationCodeSupport.pm @@ -0,0 +1,17 @@ +package Reaction::InterfaceModel::Action::User::Role::ConfirmationCodeSupport; + +use Reaction::Role; +use Crypt::Eksblowfish::Bcrypt (); +use namespace::clean -except => [ qw(meta) ]; + +sub generate_confirmation_code { + my $self = shift; + my $salt = join(q{}, map { chr(int(rand(256))) } 1 .. 16); + $salt = Crypt::Eksblowfish::Bcrypt::en_base64( $salt ); + my $settings_base = join(q{},'$2','a','$',sprintf("%02i", 8), '$'); + return Crypt::Eksblowfish::Bcrypt::bcrypt( + $self->identity_string, $settings_base . $salt + ); +} + +1;
\ No newline at end of file |