aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/ViewPort/Field
diff options
context:
space:
mode:
authorgroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-02-26 04:14:37 +0000
committergroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-02-26 04:14:37 +0000
commit24185a7d1e90ac8980462b9f471e016504d73e3c (patch)
tree0c8bc7f1d0481f7684f16bac842ebe296c215889 /lib/Reaction/UI/ViewPort/Field
parent5ae92ec0095809ce8dc2b9499212f8708cb6d2e1 (diff)
downloadreaction-24185a7d1e90ac8980462b9f471e016504d73e3c.tar.gz
reaction-24185a7d1e90ac8980462b9f471e016504d73e3c.zip
first DRAFT of matching passwords widget so we can move it out of the model. not tested yet at all.
Diffstat (limited to 'lib/Reaction/UI/ViewPort/Field')
-rw-r--r--lib/Reaction/UI/ViewPort/Field/Mutable/MatchingPasswords.pm33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/Reaction/UI/ViewPort/Field/Mutable/MatchingPasswords.pm b/lib/Reaction/UI/ViewPort/Field/Mutable/MatchingPasswords.pm
new file mode 100644
index 0000000..03cb922
--- /dev/null
+++ b/lib/Reaction/UI/ViewPort/Field/Mutable/MatchingPasswords.pm
@@ -0,0 +1,33 @@
+package Reaction::UI::ViewPort::Field::Mutable::MatchingPasswords;
+
+use Reaction::Class;
+use aliased 'Reaction::UI::ViewPort::Field::Mutable::Password';
+
+class MatchingPasswords is Password, which {
+
+ has check_value => (is => 'rw', isa => 'Str', );
+
+ #maybe both check_value and value_string should have triggers ?
+ #that way if one even happens before the other it would still work?
+ around _adopt_value_string => sub {
+ my $orig = shift;
+ my ($self) = @_;
+ return $orig->(@_) if $self->check_value eq $self->value_string;
+ $self->message("Passwords do not match");
+ };
+
+ #order is important check_value should happen before value here ...
+ #i don't like how this works, it's unnecessarily fragile, but how else ?
+ around accept_events => sub { ('check_value', shift->(@_)) };
+
+ around can_sync_to_action => sub {
+ my $orig = shift;
+ my ($self) = @_;
+ return $orig->(@_) if $self->check_value eq $self->value_string;
+ $self->message("Passwords do not match");
+ return;
+ };
+
+};
+
+1;