in reply to Re: Perl Catalyst
in thread Perl Catalyst
Thanks for this information.
App File, Authentication settings
'Plugin::Authentication' => { default_realm => 'members', members => { credential => { class => 'Password', password_field => 'password', password_type => 'self_check' }, store => { class => 'DBIx::Class', user_model => 'DB::User', } } },
modified add_columns in the User
__PACKAGE__->add_columns( 'password' => { data_type => 'varchar', encode_column => 1, encode_class => 'Crypt::PBKDF2', encode_args => { hash_class => 'HMACSHA2', hash_args => { sha_size => 512, }, iterations => 10000, salt_len => 10, }, encode_check_method => 'check_password', } );
data type of password field is varchar type, hence the varchar is used in the above code.
To my surprise, when I changed the password of the user through a script, it is not encrypting the password field
.#!/usr/bin/perl use strict; use warnings; use MyApp::Schema; my $schema = MyApp::Schema->connect('dbi:mysql:database', 'root', ''); my @users = $schema->resultset('User')->all; # Just traversing the User foreach my $user (@users) { if ($user->email eq 'xyz') { $user->password('password'); $user->update; } }
when I checked the database, it stores the password in the clear text whereas it should save it in the encrypted format.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl Catalyst
by akuk (Beadle) on Oct 10, 2018 at 19:15 UTC | |
by Your Mother (Archbishop) on Oct 10, 2018 at 20:27 UTC |