diff options
Diffstat (limited to 'authtoken.json')
-rwxr-xr-x | authtoken.json | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/authtoken.json b/authtoken.json index dbdc64a..c080028 100755 --- a/authtoken.json +++ b/authtoken.json @@ -10,8 +10,13 @@ my $errorstring = 'unknown'; my $username = ''; my $token = ''; if(defined $ENV{REMOTE_USER}) { - ($token, $status, $errorstring) = rddb::get_token($ENV{REMOTE_USER}); - $username = $ENV{REMOTE_USER}; + my $dbh; + ($dbh, $status, $errorstring) = rddb::opendb(); + if(defined $dbh) { + ($token, $status, $errorstring) = rddb::get_token($dbh, $ENV{REMOTE_USER}); + $username = $ENV{REMOTE_USER}; + rddb::closedb($dbh); + } } else { $errorstring = 'no username defined - are you logged in?'; } |