diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm index e01e110b7b54701f99639e117a55ee7f3b0826da..2ec375ad74da89bfbed982d79f5de1124ab711dc 100755 --- a/lib/IdPAccountManager/WebRequest.pm +++ b/lib/IdPAccountManager/WebRequest.pm @@ -349,41 +349,41 @@ sub req_generate_token { return undef; } - my $authentication_token = IdPAccountManager::Data::AuthenticationToken->new( + my $token = IdPAccountManager::Data::AuthenticationToken->new( db => $self->{db}, email_address => $self->{in}->{email_address}, sp_entityid => $self->{in}->{sp_entityid} ); - unless (defined $authentication_token) { + unless (defined $token) { push @{ $self->{out}->{errors} }, "internal"; $self->{logger}->error("Failed to create authentication token"); return undef; } ## First remove token if one exist for this email+SP - if ($authentication_token->load(speculative => 1)) { - unless ($authentication_token->delete()) { + if ($token->load(speculative => 1)) { + unless ($token->delete()) { push @{ $self->{out}->{errors} }, "internal"; $self->{logger}->errorf( "Failed to delete previous authentication token with ID %s", - $authentication_token->get('id') + $token->id() ); return undef; } - $authentication_token = IdPAccountManager::Data::AuthenticationToken->new( + $token = IdPAccountManager::Data::AuthenticationToken->new( db => $self->{db}, email_address => $self->{in}->{email_address}, sp_entityid => $self->{in}->{sp_entityid} ); - unless (defined $authentication_token) { + unless (defined $token) { push @{ $self->{out}->{errors} }, "internal"; $self->{logger}->error("Failed to create authentication token"); return undef; } } - unless ($authentication_token->save()) { + unless ($token->save()) { push @{ $self->{out}->{errors} }, "internal"; $self->{logger}->error("Failed to save authentication token"); return undef; @@ -411,7 +411,7 @@ sub req_generate_token { from => $self->{configuration}->{notice_from}, to => $self->{in}->{email_address}, sp_entityid => $self->{in}->{sp_entityid}, - authentication_token => $authentication_token->get('token'), + authentication_token => $token->token(), } ); }; @@ -421,7 +421,7 @@ sub req_generate_token { "Token send to %s for sp_entityid=%s;token=%s", $self->{in}->{email_address}, $self->{in}->{sp_entityid}, - $authentication_token->get('token'), + $token->token(), ); return 1;