Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I've broken this down to a minimal case:
package MyApp; use Dancer2; use Dancer2::Plugin::DBIC; use Dancer2::Plugin::Auth::Extensible; our $VERSION = '0.1'; get '/test' => require_login sub { my $user = logged_in_user; return "Hi there, $user->{username}"; }; true;
And here's the config I'm working from:
appname: "MyApp" layout: "main" charset: "UTF-8" template: template_toolkit engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' PLUGIN_BASE: 'Template::Plugin::Pagination' session: DBIC: dsn: dbi:Pg:dbname=my_app schema_class: MyApp::Schema user: starman password: ***** plugins: DBIC: default: dsn: dbi:Pg:dbname=my_app schema_class: MyApp::Schema user: starman password: ***** options: AutoCommit: 1 AutoInactiveDestroy: 1 PrintError: 0 RaiseError: 1 Auth::Extensible: realms: users: provider: 'DBIC' users_resultset: 'User' roles_resultset: 'Role' user_roles_resultset: 'UserRole'

When I navigate to /test, I get the login page.
When I enter an invalid username and password, I get the error "LOGIN FAILED" message.
When I enter a correct username and password, the login page appears to refresh, with the URL changed - each time the return_url query string is prefixed withan extra %25%2F. Eg, after a couple of loads, it looks like this:

/login?return_url=%2F%252F%252Ftest

I guess I have 2 questions - (1) Why isn't it now displaying the /test route, and (2) Is there anyway I can set up my config so I don't have to repeat the DBIC login data.

I've been going round in circles on this all day. It's probably a stupid typo somewhere. Any ideas?


In reply to Can't get Dancer2 Auth::Extensible with DBIC working by cLive ;-)

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2022-09-30 06:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (125 votes). Check out past polls.

    Notices?