Move Crypt and Schema into Model namespace (#6)
This commit is contained in:
parent
3735c17926
commit
ebcaf364ac
|
@ -6,7 +6,7 @@ use warnings;
|
||||||
use experimental qw(try smartmatch);
|
use experimental qw(try smartmatch);
|
||||||
|
|
||||||
use Mojo::Base 'Mojolicious', -signatures;
|
use Mojo::Base 'Mojolicious', -signatures;
|
||||||
use CharmBoard::Schema;
|
use CharmBoard::Model::Schema;
|
||||||
|
|
||||||
# this method will run once at server start
|
# this method will run once at server start
|
||||||
sub startup {
|
sub startup {
|
||||||
|
@ -53,7 +53,7 @@ sub startup {
|
||||||
Valid options: 'sqlite', 'mariadb'"
|
Valid options: 'sqlite', 'mariadb'"
|
||||||
}
|
}
|
||||||
|
|
||||||
our $schema = CharmBoard::Schema->connect(
|
our $schema = CharmBoard::Model::Schema->connect(
|
||||||
$_dsn,
|
$_dsn,
|
||||||
$config->{database}->{user},
|
$config->{database}->{user},
|
||||||
$config->{database}->{pass},
|
$config->{database}->{pass},
|
||||||
|
|
|
@ -6,8 +6,8 @@ use warnings;
|
||||||
use experimental qw(try smartmatch);
|
use experimental qw(try smartmatch);
|
||||||
|
|
||||||
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
||||||
use CharmBoard::Crypt::Password;
|
use CharmBoard::Model::Crypt::Password;
|
||||||
use CharmBoard::Crypt::Seasoning;
|
use CharmBoard::Model::Crypt::Seasoning;
|
||||||
|
|
||||||
sub login {
|
sub login {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
|
@ -6,7 +6,7 @@ use warnings;
|
||||||
use experimental qw(try smartmatch);
|
use experimental qw(try smartmatch);
|
||||||
|
|
||||||
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
||||||
use CharmBoard::Crypt::Password;
|
use CharmBoard::Model::Crypt::Password;
|
||||||
|
|
||||||
# initial registration page
|
# initial registration page
|
||||||
sub register {
|
sub register {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Crypt::Password;
|
package CharmBoard::Model::Crypt::Password;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
||||||
|
@ -6,7 +6,7 @@ use warnings;
|
||||||
use experimental qw(try smartmatch);
|
use experimental qw(try smartmatch);
|
||||||
|
|
||||||
use Authen::Passphrase::Argon2;
|
use Authen::Passphrase::Argon2;
|
||||||
use CharmBoard::Crypt::Seasoning;
|
use CharmBoard::Model::Crypt::Seasoning;
|
||||||
|
|
||||||
use Exporter qw(import);
|
use Exporter qw(import);
|
||||||
our @EXPORT = qw(passgen passchk);
|
our @EXPORT = qw(passgen passchk);
|
||||||
|
@ -42,16 +42,16 @@ sub passchk {
|
||||||
__END__
|
__END__
|
||||||
=pod
|
=pod
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
CharmBoard::Crypt::Password - password processing module
|
CharmBoard::Model::Crypt::Password - password processing module
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
=begin perl
|
=begin perl
|
||||||
use CharmBoard::Crypt::Password;
|
use CharmBoard::Model::Crypt::Password;
|
||||||
|
|
||||||
($salt, $hash) = passgen($plaintextPassword);
|
($salt, $hash) = passgen($plaintextPassword);
|
||||||
$passwordVerification = passchk($salt, $hash, $plaintextPassword)
|
$passwordVerification = passchk($salt, $hash, $plaintextPassword)
|
||||||
=end perl
|
=end perl
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
CharmBoard::Crypt::Password processes passwords, either processing
|
CharmBoard::Model::Crypt::Password processes passwords, either processing
|
||||||
new passwords for database storage, or checking passwords entered
|
new passwords for database storage, or checking passwords entered
|
||||||
when logging in to make sure they're correct.
|
when logging in to make sure they're correct.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Crypt::Seasoning;
|
package CharmBoard::Model::Crypt::Seasoning;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Schema;
|
package CharmBoard::Model::Schema;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Schema::Set::Categories;
|
package CharmBoard::Model::Schema::Set::Categories;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
||||||
|
@ -28,7 +28,7 @@ sub title_from_id {
|
||||||
__END__
|
__END__
|
||||||
=pod
|
=pod
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
CharmBoard::Schema::Set::Categories - DBIC ResultSet for the
|
CharmBoard::Model::Schema::Set::Categories - DBIC ResultSet for the
|
||||||
categories table
|
categories table
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Schema::Set::Subforums;
|
package CharmBoard::Model::Schema::Set::Subforums;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Schema::Set::Threads;
|
package CharmBoard::Model::Schema::Set::Threads;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Schema::Source::Categories;
|
package CharmBoard::Model::Schema::Source::Categories;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Schema::Source::Posts;
|
package CharmBoard::Model::Schema::Source::Posts;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
||||||
|
@ -33,11 +33,11 @@ __PACKAGE__->add_columns(
|
||||||
__PACKAGE__->set_primary_key('post_id');
|
__PACKAGE__->set_primary_key('post_id');
|
||||||
|
|
||||||
__PACKAGE__->belongs_to(
|
__PACKAGE__->belongs_to(
|
||||||
user_id => 'CharmBoard::Schema::Source::Users',
|
user_id => 'CharmBoard::Model::Schema::Source::Users',
|
||||||
'user_id'
|
'user_id'
|
||||||
);
|
);
|
||||||
__PACKAGE__->belongs_to(
|
__PACKAGE__->belongs_to(
|
||||||
thread_id => 'CharmBoard::Schema::Source::Threads',
|
thread_id => 'CharmBoard::Model::Schema::Source::Threads',
|
||||||
'thread_id'
|
'thread_id'
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Schema::Source::Session;
|
package CharmBoard::Model::Schema::Source::Session;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
||||||
|
@ -34,7 +34,7 @@ __PACKAGE__->add_columns(
|
||||||
__PACKAGE__->set_primary_key('session_key');
|
__PACKAGE__->set_primary_key('session_key');
|
||||||
|
|
||||||
__PACKAGE__->belongs_to(
|
__PACKAGE__->belongs_to(
|
||||||
user_id => 'CharmBoard::Schema::Source::Users',
|
user_id => 'CharmBoard::Model::Schema::Source::Users',
|
||||||
'user_id'
|
'user_id'
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Schema::Source::Subforums;
|
package CharmBoard::Model::Schema::Source::Subforums;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
||||||
|
@ -37,7 +37,7 @@ __PACKAGE__->add_columns(
|
||||||
__PACKAGE__->set_primary_key('subf_id');
|
__PACKAGE__->set_primary_key('subf_id');
|
||||||
|
|
||||||
__PACKAGE__->belongs_to(
|
__PACKAGE__->belongs_to(
|
||||||
subf_cat => 'CharmBoard::Schema::Source::Categories',
|
subf_cat => 'CharmBoard::Model::Schema::Source::Categories',
|
||||||
{ 'foreign.cat_id' => 'self.subf_cat' }
|
{ 'foreign.cat_id' => 'self.subf_cat' }
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Schema::Source::Threads;
|
package CharmBoard::Model::Schema::Source::Threads;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
||||||
|
@ -33,11 +33,11 @@ __PACKAGE__->add_columns(
|
||||||
__PACKAGE__->set_primary_key('thread_id');
|
__PACKAGE__->set_primary_key('thread_id');
|
||||||
|
|
||||||
__PACKAGE__->belongs_to(
|
__PACKAGE__->belongs_to(
|
||||||
thread_subf => 'CharmBoard::Schema::Source::Subforums',
|
thread_subf => 'CharmBoard::Model::Schema::Source::Subforums',
|
||||||
{ 'foreign.subf_id' => 'self.thread_subf' }
|
{ 'foreign.subf_id' => 'self.thread_subf' }
|
||||||
);
|
);
|
||||||
__PACKAGE__->belongs_to(
|
__PACKAGE__->belongs_to(
|
||||||
thread_op => 'CharmBoard::Schema::Source::Posts',
|
thread_op => 'CharmBoard::Model::Schema::Source::Posts',
|
||||||
{ 'foreign.post_id' => 'self.thread_op' }
|
{ 'foreign.post_id' => 'self.thread_op' }
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package CharmBoard::Schema::Source::Users;
|
package CharmBoard::Model::Schema::Source::Users;
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use strict;
|
use strict;
|
Loading…
Reference in New Issue