[dancer-users] Command line change password script (Was: Custom login page with Dancer2::Plugin::Auth::Extensible)
Stefan Hornburg (Racke)
racke at linuxia.de
Fri May 26 08:43:51 BST 2017
On 05/26/2017 08:05 AM, Nathan Bailey wrote:
> 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
> 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 <http://myscript.pl>'
> (otherwise none of the Dancer/DPAE settings are found)
That's true as the configuration files are parsed when Dancer2 is imported through "use Dancer2", so you
need to set this environment variable.
> On 16 May 2017 at 16:42, Nathan Bailey <web at polynate.net <mailto: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
> dancer-users mailing list
> dancer-users at dancer.pm
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.
More information about the dancer-users