Skip to content
Snippets Groups Projects
Commit 294bf4d4 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

more granularity in dates

parent 798e8e3d
No related branches found
No related tags found
No related merge requests found
...@@ -103,8 +103,8 @@ sub add_account { ...@@ -103,8 +103,8 @@ sub add_account {
scope => $configuration->{idp}->{scope}, scope => $configuration->{idp}->{scope},
password => $password, password => $password,
password_hash => AccountManager::Tools::sha256_hash($password), password_hash => AccountManager::Tools::sha256_hash($password),
creation_date => DateTime->today(), creation_date => DateTime->now(),
expiration_date => DateTime->today()->add(days => $validity_period) expiration_date => DateTime->now()->add(days => $validity_period)
); );
die "Failed to save test account\n" die "Failed to save test account\n"
...@@ -329,8 +329,8 @@ sub add_token { ...@@ -329,8 +329,8 @@ sub add_token {
db => $db, db => $db,
email_address => $options{email_address}, email_address => $options{email_address},
sp_entityid => $options{sp_entityid}, sp_entityid => $options{sp_entityid},
creation_date => DateTime->today(), creation_date => DateTime->now(),
expiration_date => DateTime->today()->add(hours => $validity_period), expiration_date => DateTime->now()->add(hours => $validity_period),
token => AccountManager::Tools::generate_token() token => AccountManager::Tools::generate_token()
); );
......
...@@ -11,8 +11,8 @@ CREATE TABLE `tokens` ( ...@@ -11,8 +11,8 @@ CREATE TABLE `tokens` (
`token` varchar(50) NOT NULL, `token` varchar(50) NOT NULL,
`email_address` varchar(200) NOT NULL, `email_address` varchar(200) NOT NULL,
`sp_entityid` varchar(200) NOT NULL, `sp_entityid` varchar(200) NOT NULL,
`creation_date` date DEFAULT NULL, `creation_date` datetime DEFAULT NULL,
`expiration_date` date DEFAULT NULL, `expiration_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `token_2` (`token`), UNIQUE KEY `token_2` (`token`),
KEY `token` (`token`), KEY `token` (`token`),
...@@ -31,8 +31,8 @@ CREATE TABLE `services` ( ...@@ -31,8 +31,8 @@ CREATE TABLE `services` (
CREATE TABLE `accounts` ( CREATE TABLE `accounts` (
`id` bigint(20) NOT NULL AUTO_INCREMENT, `id` bigint(20) NOT NULL AUTO_INCREMENT,
`password_hash` varchar(50) NOT NULL, `password_hash` varchar(50) NOT NULL,
`creation_date` date DEFAULT NULL, `creation_date` datetime DEFAULT NULL,
`expiration_date` date DEFAULT NULL, `expiration_date` datetime DEFAULT NULL,
`profile` varchar(100) NOT NULL, `profile` varchar(100) NOT NULL,
`scope` varchar(100) NOT NULL, `scope` varchar(100) NOT NULL,
`sp_entityid` varchar(250) NOT NULL, `sp_entityid` varchar(250) NOT NULL,
......
...@@ -12,8 +12,8 @@ __PACKAGE__->meta->setup( ...@@ -12,8 +12,8 @@ __PACKAGE__->meta->setup(
id => { type => 'bigserial', not_null => 1 }, id => { type => 'bigserial', not_null => 1 },
password_hash => { type => 'varchar', length => 50, not_null => 1 }, password_hash => { type => 'varchar', length => 50, not_null => 1 },
password => { type => 'varchar', length => 50, nonpersistent => 1 }, password => { type => 'varchar', length => 50, nonpersistent => 1 },
creation_date => { type => 'date' }, creation_date => { type => 'datetime' },
expiration_date => { type => 'date' }, expiration_date => { type => 'datetime' },
profile => { type => 'varchar', length => 100, not_null => 1 }, profile => { type => 'varchar', length => 100, not_null => 1 },
scope => { type => 'varchar', length => 100, not_null => 1 }, scope => { type => 'varchar', length => 100, not_null => 1 },
sp_entityid => { type => 'varchar', length => 250, not_null => 1 }, sp_entityid => { type => 'varchar', length => 250, not_null => 1 },
......
...@@ -13,8 +13,8 @@ __PACKAGE__->meta->setup( ...@@ -13,8 +13,8 @@ __PACKAGE__->meta->setup(
token => { type => 'varchar', length => 50, not_null => 1 }, token => { type => 'varchar', length => 50, not_null => 1 },
email_address => { type => 'varchar', length => 200, not_null => 1 }, email_address => { type => 'varchar', length => 200, not_null => 1 },
sp_entityid => { type => 'varchar', length => 200, not_null => 1 }, sp_entityid => { type => 'varchar', length => 200, not_null => 1 },
creation_date => { type => 'date' }, creation_date => { type => 'datetime' },
expiration_date => { type => 'date' }, expiration_date => { type => 'datetime' },
], ],
primary_key_columns => [ 'id' ], primary_key_columns => [ 'id' ],
...@@ -35,8 +35,8 @@ sub print { ...@@ -35,8 +35,8 @@ sub print {
$self->token(), $self->token(),
$self->email_address(), $self->email_address(),
$self->sp_entityid(), $self->sp_entityid(),
$self->creation_date()->strftime('%Y:%m:%d'), $self->creation_date()->strftime('%Y:%m:%d %H:%M'),
$self->expiration_date()->strftime('%Y:%m:%d'); $self->expiration_date()->strftime('%Y:%m:%d %H:%M');
} }
1; 1;
...@@ -345,8 +345,8 @@ sub req_generate_token { ...@@ -345,8 +345,8 @@ sub req_generate_token {
db => $self->{db}, db => $self->{db},
email_address => $self->{in}->{email_address}, email_address => $self->{in}->{email_address},
sp_entityid => $self->{in}->{sp_entityid}, sp_entityid => $self->{in}->{sp_entityid},
creation_date => DateTime->today(), creation_date => DateTime->now(),
expiration_date => DateTime->today()->add(hours => $validity_period), expiration_date => DateTime->now()->add(hours => $validity_period),
token => AccountManager::Tools::generate_token() token => AccountManager::Tools::generate_token()
); );
...@@ -480,8 +480,8 @@ sub req_validate_token { ...@@ -480,8 +480,8 @@ sub req_validate_token {
scope => $self->{configuration}->{idp}->{scope}, scope => $self->{configuration}->{idp}->{scope},
password => $password, password => $password,
password_hash => AccountManager::Tools::sha256_hash($password), password_hash => AccountManager::Tools::sha256_hash($password),
creation_date => DateTime->today(), creation_date => DateTime->now(),
expiration_date => DateTime->today()->add(days => $validity_period) expiration_date => DateTime->now()->add(days => $validity_period)
); );
next unless $account->save(); next unless $account->save();
push @accounts, $account; push @accounts, $account;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment