+++ /dev/null
-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
--- /dev/null
+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