File: hash_passwords.pl

package info (click to toggle)
libmojomojo-perl 1.11%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,496 kB
  • ctags: 927
  • sloc: perl: 14,671; sh: 148; xml: 120; makefile: 8; ruby: 6
file content (45 lines) | stat: -rw-r--r-- 1,080 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl 
#===============================================================================
#
#         FILE:  hash_passwords.pl
#
#        USAGE:  ./hash_passwords.pl 
#
#  DESCRIPTION:  
#
#      OPTIONS:  ---
# REQUIREMENTS:  ---
#         BUGS:  ---
#        NOTES:  ---
#       AUTHOR:  Marcus Ramberg (MRAMBERG), <mramberg@cpan.org>
#      COMPANY:  Nordaaker Ltd
#      VERSION:  1.0
#      CREATED:  06/27/2008 22:59:39 CEST
#     REVISION:  ---
#===============================================================================
=head1 NAME

hash_passwords.pl - hash plain text passwords

=head1 AUTHOR

Marcus Ramberg (MRAMBERG), <mramberg@cpan.org>

=cut

use strict;
use warnings;

use FindBin;
use lib "$FindBin::Bin/../lib";
use MojoMojo;

my $users=MojoMojo->model('DBIC::Person')->search;
my $first=$users->first;
die "First password is 40 chars. Probably already converted" if length($first->pass) == 40;
$users->reset;
while (my $user=$users->next) {
    $user->pass($user->get_column('pass'));
    $user->update;
}
print $users->count() ." users updated.\n";