Fwd: DPAE and reset passwords (Dancer2::Plugin::Auth::Extensible)
On 3 April 2017 at 19:38, Andrew Beverley <andy@andybev.com> wrote:
On Mon, 3 Apr 2017 19:15:31 +1000 Nathan Bailey wrote:
but then clicking the 'Reset password' button doesn't seem to do anything.
As in does a POST request and forwards back to the same page, or nothing at all?
Back to the same page.
The "$app->log(...)" statements don't seem to be appearing anywhere, is there a 'debug' mode I need to turn on or a config setting to direct the logging to a file/Log::Report?
Yes, you can configure that per-dispatcher (with the mode changed to DEBUG) but probably easier just to do:
use Dancer2::Plugin::LogReport mode => 'DEBUG';
That's in my Main and Extensible.pm but still doesn't seem to give me joy (other logging is working fine, but nothing from Extensible.pm) I've put my own 'warn' statements in each subroutine to see the flow (see below). DPAEPD lacked a 'get_user_by_code' function; I've added the following and now the reset password process is happy. sub get_user_by_code { my ($self, $code) = @_; croak "code must be defined" unless defined $code; # Get our database handle and find out the table and column names: my $database = $self->database; # Get just the username of the user with the matching pw_reset_code my $user = $database->quick_lookup( $self->users_table, { 'pw_reset_code' => $code }, 'username' ); if (!$user) { $self->plugin->app->log("debug", "No such code $code"); return; } else { return $user; } } However, when I try to log in with my reset password, I'm stuck in a loop at https://metacpan.org/source/HORNBURG/Dancer2- Plugin-Auth-Extensible-0.703/lib/Dancer2/Plugin/Auth/Extensible.pm#L266; my home page doesn't seem to want to load. I have a 'get' route for '/' but perhaps something is missing somewhere logged_in_user at /Library/Perl/5.18/Dancer2/Plugin/Auth/Extensible.pm line 593. get_user_details at /Library/Perl/5.18/Dancer2/Plugin/Auth/Extensible.pm line 571. plugin-get_user_details at /Library/Perl/5.18/Dancer2/ Plugin/Auth/Extensible/Provider/Database.pm line 375. Use of uninitialized value in concatenation (.) or string at /Library/Perl/5.18/Dancer2/Plugin/Auth/Extensible.pm line 265. Get here, return_url='', home page='/' at /Library/Perl/5.18/Dancer2/Plugin/Auth/Extensible.pm line 265. thanks, Nathan
On 4 April 2017 at 17:18, Nathan Bailey <web@polynate.net> wrote:
However, when I try to log in with my reset password, I'm stuck in a loop at https://metacpan.org/source/HORNBURG/Dancer2-Plugin-Auth- Extensible-0.703/lib/Dancer2/Plugin/Auth/Extensible.pm#L266; my home page doesn't seem to want to load.
I have a 'get' route for '/' but perhaps something is missing somewhere logged_in_user at /Library/Perl/5.18/Dancer2/Plugin/Auth/Extensible.pm line 593. get_user_details at /Library/Perl/5.18/Dancer2/Plugin/Auth/Extensible.pm line 571. plugin-get_user_details at /Library/Perl/5.18/Dancer2/Plu gin/Auth/Extensible/Provider/Database.pm line 375. Use of uninitialized value in concatenation (.) or string at /Library/Perl/5.18/Dancer2/Plugin/Auth/Extensible.pm line 265. Get here, return_url='', home page='/' at /Library/Perl/5.18/Dancer2/Plugin/Auth/Extensible.pm line 265.
Oops. It was our previous login handler not recognising the auth that DPAE had done :P Would still like to know how to get the Log::Reporting working in Extensible.pm though? thanks, -N
On Wed, 5 Apr 2017 04:25:25 +1000 Nathan Bailey wrote:
Oops. It was our previous login handler not recognising the auth that DPAE had done :P
No problem :)
Would still like to know how to get the Log::Reporting working in Extensible.pm though?
Not sure why, as the plugin just calls the standard Dancer logging routines in the same way the main app would. I've just tried it myself (with both the LogReport plugin and the logger) and it works okay for me. I suspect the logging level is changing somewhere. Do you have an example dancer app that I can look at please? Andy
participants (2)
-
Andrew Beverley -
Nathan Bailey