1 package Reaction::InterfaceModel::Action::User::Login;
4 use aliased 'Reaction::InterfaceModel::Action';
5 use Reaction::Types::Core qw(SimpleStr Password);
7 use namespace::clean -except => [ qw(meta) ];
12 has 'username' => (isa => SimpleStr, is => 'rw', lazy_fail => 1);
13 has 'password' => (isa => Password, is => 'rw', lazy_fail => 1);
15 around error_for_attribute => sub {
17 my ($self, $attr) = @_;
18 my $result = $super->(@_);
19 my $predicate = $attr->get_predicate_method;
20 if (defined $result && $self->$predicate) {
21 return 'Invalid username or password';
27 my $target = $self->target_model;
28 return $target->login($self->username, $self->password);
30 __PACKAGE__->meta->make_immutable;
37 Reaction::InterfaceModel::Action::User::Login
47 See L<Reaction::Class> for authors.
51 See L<Reaction::Class> for the license.