[dancer-users] Command line change password script (Was: Custom login page with Dancer2::Plugin::Auth::Extensible)

Nathan Bailey web at polynate.net
Fri May 26 07:05:42 BST 2017


Okay, so the solution to this is:
    use Dancer2;
    use Dancer2::Plugin::Auth::Tiny; # wrap route handlers with an
authentication closure
    use Dancer2::Plugin::Database;   # provide the 'database' keyword for a
simple DBI DB handle
    use Dancer2::Plugin::Auth::Extensible; # for login, password resets and
roles
    use Dancer2::Plugin::Auth::Extensible::Provider::Database; # for login,
password resets and roles
    # From Dancer2::Config: "If neither "PLACK_ENV" or "DANCER_ENVIRONMENT"
is set, the environment defaults to development."
    set environment => 'development'; # Note: This informs which
enviroments/xxx.yml file is used

    my $dpae = Dancer2::Plugin::Auth::Extensible::Provider::Database->new(
        plugin => app,
    );

However, the 'set environment' doesn't seem to work, so the script needs to
be run as 'DANCER_ENVIRONMENT=development myscript.pl'
(otherwise none of the Dancer/DPAE settings are found)
-N

On 16 May 2017 at 16:42, Nathan Bailey <web at polynate.net> wrote:

> Hi all,
>  Separate but somewhat related to my previous questions - how can I make a
> command line script to do a change password, using the DPAE infrastructure?
>
> Presumably I will need to use Dancer2? Or can I dig directly into
> DPAE's set_user_password()?
>
> Dancer2::Plugin::Auth::Extensible::Provider::Database->new() wants a
> 'plugin', and Dancer2::Plugin::Auth::Extensible->new() wants an 'app'; I
> could pass fake values in but I suspect that's going to break things. How
> far up the tree do I need to go to be able to say "Use XXX", "XXX->new" and
> "XXX...->set_user_password"?
>
> thanks,
> Nathan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20170526/54ee5918/attachment.html>


More information about the dancer-users mailing list