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

use shorter variable names

parent 38fcf630
No related branches found
No related tags found
No related merge requests found
......@@ -129,12 +129,12 @@ sub list_accounts {
foreach my $account (@$accounts) {
$account->print();
next unless $options{delete};
die "failed to delete test account\n"
unless $account->delete();
}
if ($options{delete}) {
foreach my $account (@$accounts) {
$account->delete() or die "failed to delete test account\n";
}
printf "%d accounts removed\n", @$accounts;
die "failed to update simpleSAMLphp configuration file\n"
......@@ -250,12 +250,12 @@ sub list_tokens {
foreach my $token (@$tokens) {
$token->print();
next unless $options{delete};
die "failed to delete authentication token\n"
unless $token->delete();
}
if ($options{delete}) {
foreach my $token (@$tokens) {
$token->delete() or die "failed to delete authentication token\n";
}
printf "%d tokens removed\n", @$tokens;
}
......@@ -269,19 +269,18 @@ sub get_token {
$args{token} = $options{token};
}
my $authentication_token =
my $token =
IdPAccountManager::AuthenticationToken->new(db => $db, %args);
die "No corresponding token found in DB\n"
unless $authentication_token->load();
unless $token->load();
if ($options{sp_entityid}) {
die "Authentication token cannot be used for this SP\n"
unless $authentication_token->get('sp_entityid')
eq $options{sp_entityid};
unless $token->get('sp_entityid') eq $options{sp_entityid};
}
$authentication_token->print();
$token->print();
}
......@@ -297,33 +296,31 @@ sub add_token {
-verbose => 0
) unless $options{sp_entityid};
my $authentication_token = IdPAccountManager::Data::AuthenticationToken->new(
my $token = IdPAccountManager::Data::AuthenticationToken->new(
db => $db,
email_address => $options{email_address},
sp_entityid => $options{sp_entityid}
);
die "failed to create authentication token\n"
unless $authentication_token;
unless $token;
## First remove token if on exist for this email+SP
if ($authentication_token->load(speculative => 1)) {
die "failed to delete authentication token\n"
unless $authentication_token->delete();
if ($token->load(speculative => 1)) {
$token->delete() or die "failed to delete authentication token\n";
$authentication_token = IdPAccountManager::Data::AuthenticationToken->new(
$token = IdPAccountManager::Data::AuthenticationToken->new(
db => $db,
email_address => $options{email_address},
sp_entityid => $options{sp_entityid}
);
die "failed to create authentication token\n"
unless $authentication_token;
unless $token;
}
die "failed to save authentication token\n"
unless $authentication_token->save();
$token->save() or die "failed to save authentication token\n";
$authentication_token->print();
$token->print();
}
......
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