1 package Reaction::InterfaceModel::Action::User::Login;
4 use aliased 'Reaction::InterfaceModel::Action';
5 use Reaction::Types::Core qw(SimpleStr Password);
7 class Login, is Action, which {
9 has 'username' => (isa => SimpleStr, is => 'rw', lazy_fail => 1);
10 has 'password' => (isa => Password, is => 'rw', lazy_fail => 1);
12 around error_for_attribute => sub {
14 my ($self, $attr) = @_;
15 my $result = $super->(@_);
16 my $predicate = $attr->get_predicate_method;
17 if (defined $result && $self->$predicate) {
18 return 'Invalid username or password';
23 implements do_apply => as {
25 my $target = $self->target_model;
26 return $target->login($self->username, $self->password);
34 Reaction::InterfaceModel::Action::User::Login
44 See L<Reaction::Class> for authors.
48 See L<Reaction::Class> for the license.