From b86fd0ec85e0813da43895c55c5b9f5a3e5b6413 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Tue, 14 Nov 2017 17:02:47 +0100
Subject: [PATCH] declare password attribute as non-persistent

---
 lib/IdPAccountManager/TestAccount.pm | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/IdPAccountManager/TestAccount.pm b/lib/IdPAccountManager/TestAccount.pm
index bb36912..f089daf 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})
-- 
GitLab