predicate => 'has_user',
);
+# verification needs to be done here, since there are cases where
+# can_apply doesn't run, such as fields being left blank, invalid, etc.
+around sync_all => sub {
+ my $super = shift;
+ my ($self) = @_;
+ $self->verify_confirmation_code;
+ $self->$super(@_);
+};
+
around can_apply => sub {
my $super = shift;
my ($self) = @_;
- return 0 unless $self->verify_confirmation_code;
+ return 0 unless $self->has_user;
return $super->(@_);
};
my $supplied_code = $self->confirmation_code;
if (defined(my $user = $model->find_by_confirmation_code($supplied_code))) {
$self->user($user);
- return 1;
}
- return;
}
around error_for_attribute => sub {
around can_apply => sub {
my $super = shift;
my ($self) = @_;
- return 0 unless $self->verify_confirm_new_password;
- return $super->(@_);
+ return $super->(@_) && $self->verify_confirm_new_password;;
};
sub verify_confirm_new_password {
my $self = shift;
use Crypt::Eksblowfish::Bcrypt ();
use namespace::clean -except => [ qw(meta) ];
+requires 'identity_string';
+
sub generate_confirmation_code {
my $self = shift;
my $salt = join(q{}, map { chr(int(rand(256))) } 1 .. 16);
);
}
-1;
\ No newline at end of file
+1;