- diff --git a/dev/mojo-user-auth/catalyst/Build.PL b/dev/mojo-user-auth/catalyst/Build.PL
- index 5be4ad5..8f37367 100644
- --- a/dev/mojo-user-auth/catalyst/Build.PL
- +++ b/dev/mojo-user-auth/catalyst/Build.PL
- @@ -19,21 +19,30 @@ my $build = Test::Run::Builder->new(
- },
- requires =>
- {
- - 'Catalyst::Runtime' => '5.80022',
- 'Catalyst::Action::RenderView' => 0,
- + 'Catalyst::Authentication::Store::DBIx::Class' => 0,
- + 'Catalyst::Controller::HTML::FormFu' => 0,
- 'Catalyst::Plugin::Authentication' => '0.03',
- + 'Catalyst::Plugin::Authorization::Roles' => 0,
- 'Catalyst::Plugin::ConfigLoader' => 0,
- - 'Catalyst::Plugin::Static::Simple' => 0,
- 'Catalyst::Plugin::Session' => 0,
- - 'Catalyst::Plugin::Session::Store::FastMmap' => 0,
- 'Catalyst::Plugin::Session::State::Cookie' => 0,
- - 'Catalyst::Plugin::Authorization::Roles' => 0,
- + 'Catalyst::Plugin::Session::Store::FastMmap' => 0,
- 'Catalyst::Plugin::StackTrace' => 0,
- - 'Catalyst::Authentication::Store::DBIx::Class' => 0,
- + 'Catalyst::Plugin::Static::Simple' => 0,
- + 'Catalyst::Runtime' => '5.80022',
- 'Catalyst::View::TT' => 0,
- - 'Catalyst::Controller::HTML::FormFu' => 0,
- + 'CGI' => 0,
- 'Digest' => 0,
- + 'Email::Sender::Simple' => 0,
- + 'Email::Simple' => 0,
- + 'Email::Simple::Creator' => 0,
- 'HTML::Scrubber' => 0.08,
- + 'KiokuDB' => 0,
- + 'KiokuX::User' => 0,
- + 'KiokuX::User::Util' => 0,
- + 'Moose' => 0,
- + 'URI::Escape' => 0,
- 'YAML' => 0,
- },
- license => "mit",
- diff --git a/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/App.pm b/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/App.pm
- index 882ee1e..624ac50 100644
- --- a/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/App.pm
- +++ b/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/App.pm
- @@ -367,7 +367,7 @@ sub _generic_find_user
- return;
- }
- - my $stream = $self->_search({email => $user_id});
- + my $stream = $self->_search({id => $user_id});
- FIND_EMAIL:
- while ( my $block = $stream->next )
- @@ -510,15 +510,17 @@ sub _send_confirmation_email
- return;
- }
- +use KiokuX::User::Util qw(crypt_password);
- +
- sub _register_new_user
- {
- my $self = shift;
- -
- +
- my $new_user = InsurgentSoftware::UserAuth::User->new(
- {
- fullname => $self->param("fullname"),
- - password => $self->_password(),
- - email => $self->_email,
- + password => crypt_password($self->_password()),
- + id => $self->_email,
- confirm_code => $self->_get_confirm_code(),
- }
- );
- diff --git a/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/Catalyst/Controller/Auth.pm b/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/Catalyst/Controller/Auth.pm
- index 984df30..c43d3ec 100644
- --- a/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/Catalyst/Controller/Auth.pm
- +++ b/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/Catalyst/Controller/Auth.pm
- @@ -41,14 +41,6 @@ sub begin :Private {
- my $dir = KiokuDB->connect(
- "dbi:SQLite:dbname=./insurgent-auth.sqlite",
- create => 1,
- - columns =>
- - [
- - email =>
- - {
- - data_type => "varchar",
- - is_nullable => 1,
- - },
- - ],
- );
- $c->stash->{dir} = $dir;
- diff --git a/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/User.pm b/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/User.pm
- index fd38cf2..a013249 100644
- --- a/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/User.pm
- +++ b/dev/mojo-user-auth/catalyst/lib/InsurgentSoftware/UserAuth/User.pm
- @@ -1,12 +1,17 @@
- package InsurgentSoftware::UserAuth::User;
- use Moose;
- +
- +use KiokuX::User::Util qw(crypt_password);
- +
- use InsurgentSoftware::UserAuth::UserExtraData;
- use Crypt::SaltedHash;
- use DateTime;
- +with qw(KiokuX::User);
- +
- =head1 NAME
- InsurgentSoftware::UserAuth::User - a class representing the user-data.
- @@ -24,28 +29,6 @@ has fullname => (
- is => "rw",
- );
- -=head2 $user->email()
- -
- -The email address of the user.
- -
- -=cut
- -
- -has email => (
- - isa => "Str",
- - is => "rw",
- -);
- -
- -=head2 $self->salted_password()
- -
- -The salted password.
- -
- -=cut
- -
- -has salted_password => (
- - isa => "Str",
- - is => "rw",
- -);
- -
- =head2 $self->extra_data()
- The associated InsurgentSoftware::UserAuth::UserExtraData .
- @@ -126,15 +109,7 @@ sub assign_password
- {
- my ($self, $password) = @_;
- - my $csh = Crypt::SaltedHash->new(
- - algorithm => 'SHA-256',
- - salt_len => __PACKAGE__->get_salt_len(),
- - );
- - $csh->add($password);
- -
- - my $salted = $csh->generate;
- -
- - $self->salted_password($salted);
- + $self->password(crypt_password($password));
- return;
- }
- @@ -165,19 +140,25 @@ sub verify_password
- my $self = shift;
- my $pass = shift;
- - return Crypt::SaltedHash->validate($self->salted_password(), $pass,
- - __PACKAGE__->get_salt_len());
- + return $self->check_password($pass);
- }
- -=head2 $self->get_salt_len()
- +=head2 email
- -Returns the salt length for the password.
- +Maps to the id().
- =cut
- -sub get_salt_len
- +sub email
- {
- - return 8;
- + my $self = shift;
- +
- + if (@_)
- + {
- + $self->id(shift);
- + }
- +
- + return $self->id();
- }
- 1;