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

declare password attribute as non-persistent

parent f58a471e
No related branches found
No related tags found
No related merge requests found
......@@ -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})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment