diff options
author | Derf Null <derf@finalrewind.org> | 2023-06-26 19:40:29 +0200 |
---|---|---|
committer | Derf Null <derf@finalrewind.org> | 2023-06-26 19:50:49 +0200 |
commit | 0702a0edca47bef27e8beeac0aad5f7a5da4f14c (patch) | |
tree | 9c3e85b59934c5039c962e0259f0ce8beab6e8e4 /t/22-visibility.t | |
parent | 9b54276e8c3ddf4004207c1a92801b688541428c (diff) |
Move hash_password to Model/Users
Diffstat (limited to 't/22-visibility.t')
-rw-r--r-- | t/22-visibility.t | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/t/22-visibility.t b/t/22-visibility.t index 6e3fd38..6e827c5 100644 --- a/t/22-visibility.t +++ b/t/22-visibility.t @@ -11,7 +11,6 @@ use Mojo::Base -strict; use Test::More; use Test::Mojo; -use Crypt::Eksblowfish::Bcrypt qw(bcrypt en_base64); use DateTime; use Travel::Status::DE::IRIS::Result; @@ -41,14 +40,6 @@ $t->app->start( 'database', 'migrate' ); my $u = $t->app->users; -sub hash_password { - my ($password) = @_; - my @salt_bytes = map { int( rand(255) ) + 1 } ( 1 .. 16 ); - my $salt = en_base64( pack( 'C[16]', @salt_bytes ) ); - - return bcrypt( substr( $password, 0, 10000 ), '$2a$12$' . $salt ); -} - sub login { my %opt = @_; my $csrf_token @@ -202,24 +193,24 @@ sub test_visibility { } my $uid1 = $u->add( - name => 'test1', - email => 'test1@example.org', - token => 'abcd', - password_hash => hash_password('password1'), + name => 'test1', + email => 'test1@example.org', + token => 'abcd', + password => 'password1', ); my $uid2 = $u->add( - name => 'test2', - email => 'test2@example.org', - token => 'efgh', - password_hash => hash_password('password2'), + name => 'test2', + email => 'test2@example.org', + token => 'efgh', + password => 'password2', ); my $uid3 = $u->add( - name => 'test3', - email => 'test3@example.org', - token => 'ijkl', - password_hash => hash_password('password3'), + name => 'test3', + email => 'test3@example.org', + token => 'ijkl', + password => 'password3', ); $u->verify_registration_token( |