diff options
author | edenc <edenc@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-11-25 13:26:22 +0000 |
---|---|---|
committer | edenc <edenc@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-11-25 13:26:22 +0000 |
commit | 124d377d356ebaa5b1293a4d7b536713b5a6c676 (patch) | |
tree | 5e80ff6066a756953dcb5ffda70223e9e4567415 /lib/Reaction/InterfaceModel | |
parent | 09d2d18d3ee75780b3c7922bb0af004cf58b4be1 (diff) | |
download | reaction-124d377d356ebaa5b1293a4d7b536713b5a6c676.tar.gz reaction-124d377d356ebaa5b1293a4d7b536713b5a6c676.zip |
fixed error message display bug in Reset Password
Diffstat (limited to 'lib/Reaction/InterfaceModel')
3 files changed, 14 insertions, 6 deletions
diff --git a/lib/Reaction/InterfaceModel/Action/User/ResetPassword.pm b/lib/Reaction/InterfaceModel/Action/User/ResetPassword.pm index fc57cc2..fdb76a0 100644 --- a/lib/Reaction/InterfaceModel/Action/User/ResetPassword.pm +++ b/lib/Reaction/InterfaceModel/Action/User/ResetPassword.pm @@ -15,10 +15,19 @@ has 'user' => ( 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->(@_); }; @@ -29,9 +38,7 @@ sub verify_confirmation_code { 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 { diff --git a/lib/Reaction/InterfaceModel/Action/User/SetPassword.pm b/lib/Reaction/InterfaceModel/Action/User/SetPassword.pm index b9aa5d5..06e56c6 100644 --- a/lib/Reaction/InterfaceModel/Action/User/SetPassword.pm +++ b/lib/Reaction/InterfaceModel/Action/User/SetPassword.pm @@ -26,8 +26,7 @@ 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; diff --git a/lib/Reaction/InterfaceModel/Object/User/Role/ConfirmationCodeSupport.pm b/lib/Reaction/InterfaceModel/Object/User/Role/ConfirmationCodeSupport.pm index 7538119..4830d08 100644 --- a/lib/Reaction/InterfaceModel/Object/User/Role/ConfirmationCodeSupport.pm +++ b/lib/Reaction/InterfaceModel/Object/User/Role/ConfirmationCodeSupport.pm @@ -4,6 +4,8 @@ use Reaction::Role; 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); @@ -14,4 +16,4 @@ sub generate_confirmation_code { ); } -1;
\ No newline at end of file +1; |