aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/InterfaceModel/Action/User/Role/ConfirmationCodeSupport.pm
blob: 649f76ad946fec7aad29b39bdb84add03bd9a704 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package Reaction::InterfaceModel::Action::User::Role::ConfirmationCodeSupport;

use Reaction::Role;
use Digest::MD5;

role ConfirmationCodeSupport, which{

  #requires qw/target_model ctx/;

  implements generate_confirmation_code => as {
    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