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.
-
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 How to display code and escape characters
are good places to start.