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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
use utf8;
package ASM::DB::Result::User;
use strict;
use warnings;
use parent 'DBIx::Class::Core';
use Authen::Passphrase::RejectAll;
__PACKAGE__->load_components('InflateColumn::DateTime', 'PassphraseColumn');
__PACKAGE__->table('users');
__PACKAGE__->add_columns(
id => {
data_type => 'bigint',
is_auto_increment => 1,
is_nullable => 0
},
name => {
data_type => 'varchar',
size => 20,
is_nullable => 0,
},
passphrase => {
data_type => 'text',
passphrase => 'rfc2307',
passphrase_class => 'BlowfishCrypt',
passphrase_args => {
cost => 13,
salt_random => 1,
},
passphrase_check_method => 'check_password',
is_nullable => 0,
},
flag_secret => {
data_type => 'boolean',
is_nullable => 0,
default_value => 0,
},
flag_hilights => {
data_type => 'boolean',
is_nullable => 0,
default_value => 0,
},
flag_admin => {
data_type => 'boolean',
is_nullable => 0,
default_value => 0,
},
flag_plugin => {
data_type => 'boolean',
is_nullable => 0,
default_value => 0,
},
flag_debug => {
data_type => 'boolean',
is_nullable => 0,
default_value => 0,
},
);
__PACKAGE__->set_primary_key('id');
__PACKAGE__->add_unique_constraint(uniq_user_name => ['name']);
sub new {
my $self = shift;
$_[0]{passphrase} //= Authen::Passphrase::RejectAll->new;
$self->SUPER::new(@_);
}
1;
|