You can make the check_credentials a method of that controller rather than a function and call it as $self->check_credentials. Or if you need it outside of that controller you can even make it a helper method.
-Dan On Tue, Nov 27, 2018 at 12:10 PM Boyd Duffee <[email protected]> wrote: > Writing up my Advent post, I went down a rabbit hole and got hit by a > design decision that was made when I was first learning Mojo. If > someone could confirm or correct my thinking, I'd be very appreciative. > > The post in question is at > > https://github.com/duffee/Mojolicious_session_example/blob/master/docs/Advent_calendar/Authenticating_LDAP.md > and the section that's giving me problems starts with > Mojolicious::Plugin::Scrypt > > I call an action 'on_user_login' which checks credentials > > if ( check_credentials($username, $password) ) { > > using a sub in the Controller module like this > > sub check_credentials { > my ($username, $password) = @_; > > **Did I just lose the ability to use a plugin** by not calling the sub > as a method of the controller? I'd like to be able to do this > > return $self->scrypt_verify($password, $encoded); > > Is there a way of getting back the controller or use a plugin directly, > such as > Mojolicious::Plugin::Scrypt->new->scrypt_verify() > > You can tell I'm clutching at straws, here. > > thanks, > -- > Boyd Duffee Keele University (01782) 734225 > DevOps - Student Facing Systems > There are 2 truly great scripting languages beginning with P. > Perl and Raku. > > -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/mojolicious. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
