1 package Reaction::UI::ViewPort::Field::Mutable::MatchingPasswords;
4 use aliased 'Reaction::UI::ViewPort::Field::Mutable::Password';
6 use namespace::clean -except => [ qw(meta) ];
11 has check_value => (is => 'rw', isa => 'Str', );
12 has check_label => (is => 'rw', isa => 'Str', lazy_build => 1);
13 sub _build_check_label {
14 my $orig_label = shift->label;
15 return "Confirm ${orig_label}";
18 #maybe both check_value and value_string should have triggers ?
19 #that way if one even happens before the other it would still work?
20 around adopt_value_string => sub {
23 return $orig->(@_) if $self->check_value eq $self->value_string;
24 $self->message("Passwords do not match");
28 #order is important check_value should happen before value here ...
29 #i don't like how this works, it's unnecessarily fragile, but how else ?
30 around accept_events => sub { ('check_value', shift->(@_)) };
32 around can_sync_to_action => sub {
35 return $orig->(@_) if $self->check_value eq $self->value_string;
36 $self->message("Passwords do not match");
40 __PACKAGE__->meta->make_immutable;