diff --git a/lib/IdPAccountManager/TestAccount.pm b/lib/IdPAccountManager/TestAccount.pm index bb36912497fec3f32814a3f4bbfd682cfc8f624b..f089dafe94b71c96f92eaae6e7a38c98a97c5ae7 100644 --- a/lib/IdPAccountManager/TestAccount.pm +++ b/lib/IdPAccountManager/TestAccount.pm @@ -13,6 +13,7 @@ __PACKAGE__->meta->setup( columns => [ id => { type => 'bigserial', not_null => 1 }, password_hash => { type => 'varchar', length => 50, not_null => 1 }, + password => { type => 'varchar', length => 50, nonpersistent => 1 }, creation_date => { type => 'date' }, expiration_date => { type => 'date' }, profile => { type => 'varchar', length => 100, not_null => 1 }, @@ -125,21 +126,15 @@ sub print { $self->expiration_date()->strftime('%Y:%m:%d'); } -sub password { - my ($self) = @_; - - return $self->{password}; -} - sub save { my ($self, %args) = @_; # If no ID is defined, it is a new account if (! defined $self->id()) { - $self->{password} = - IdPAccountManager::Tools::generate_password(); + $self->password( + IdPAccountManager::Tools::generate_password()); $self->password_hash( - IdPAccountManager::Tools::sha256_hash($self->{password})); + IdPAccountManager::Tools::sha256_hash($self->password())); $self->creation_date(DateTime->today()); $self->expiration_date( DateTime->today()->add(days => $args{accounts_validity_period})