[Catalyst] Reaction Authentication

Guillermo Roditi groditi at gmail.com
Sun Jan 28 00:18:03 GMT 2007


FIXED IT!!!

take out the does '...' line and replace it with this:

override parameter_hashref => sub{
    my $self = shift;
    my $args = super();
    $args->{password} = delete $args->{new_password};
    delete $args->{confirm_new_password};
    return $args;
};


here's my class:

package Prefab::Model::Action::CreateUser;

use strict;
use warnings;

use Reaction::Class;
use aliased 'Reaction::InterfaceModel::Action::DBIC::ActionReflector';

extends qw(
           Reaction::InterfaceModel::Action::User::SetPassword
           Reaction::InterfaceModel::Action::DBIC::ResultSet::Create
          );

my $r = ActionReflector->new;
$r->reflect_attrs('Prefab::Schema::User'  =>  __PACKAGE__,
                  qw/id username created_d role_list/);

override parameter_hashref => sub{
    my $self = shift;
    my $args = super();
    $args->{password} = delete $args->{new_password};
    delete $args->{confirm_new_password};
    return $args;
};

1;



If you want to reflect fields like i did then add this method to
action reflector:

  implements reflect_attrs => as {
    my ($self, $from_class, $to_class, @attrs) = @_;
    foreach my $attr_name (@attrs) {
      $self->reflect_attribute_to($from_class,
                                  $from_class->meta->get_attribute($attr_name),
                                  $to_class);
    }
  };




On 1/27/07, Guillermo Roditi <groditi at gmail.com> wrote:
> I just ran into this bug too
>
> target_model isa => 'ResultSet' on Create, not a Row, so it lacks a
> password field. it is mildly retarded. i dont know how to fix it in an
> elegant manner.. but at least i know now what the problem is...
>
> if i get lucky this will probably be fixed in svn soonish
>
> On 1/25/07, Jonas Alves <jonas.alves at gmail.com> wrote:
> >
> >
> > On 25/01/07, Guillermo Roditi <groditi at gmail.com> wrote:
> > > what i meant is that you get new_password and confirm_new password,
> > > but you still need the original password field
> > >
> > > see code for
> > Reaction::InterfaceModel::Action::DBIC::User::Role::SetPassword;
> >
> >  Yes, but i have the password field in the model passed to "target_model".
> >
> >
> >
> > _______________________________________________
> > List: Catalyst at lists.rawmode.org
> > Listinfo:
> > http://lists.rawmode.org/mailman/listinfo/catalyst
> > Searchable archive:
> > http://www.mail-archive.com/catalyst@lists.rawmode.org/
> > Dev site: http://dev.catalyst.perl.org/
> >
> >
> >
>



More information about the Catalyst mailing list