summaryrefslogtreecommitdiff
path: root/rh-bin/authtoken.json
diff options
context:
space:
mode:
Diffstat (limited to 'rh-bin/authtoken.json')
-rwxr-xr-xrh-bin/authtoken.json9
1 files changed, 8 insertions, 1 deletions
diff --git a/rh-bin/authtoken.json b/rh-bin/authtoken.json
index e56daa9..743ac96 100755
--- a/rh-bin/authtoken.json
+++ b/rh-bin/authtoken.json
@@ -32,6 +32,8 @@ while (my $q = CGI::Fast->new) {
my $username = '';
my $token = '';
my $fullname = '';
+ my $responsecode = 500;
+
if(defined $ENV{REMOTE_USER}) {
my $dbh;
($dbh, $status, $errorstring) = RHRD::rddb::opendb();
@@ -42,9 +44,13 @@ while (my $q = CGI::Fast->new) {
($fullname, $status, $errorstring) = RHRD::rddb::get_fullname($dbh, $username);
$fullname = '' unless($fullname);
RHRD::rddb::closedb($dbh);
+ if($status == "OK") {
+ $responsecode = 200;
+ }
}
} else {
$errorstring = 'no username defined - are you logged in?';
+ $responsecode = 400;
}
my %answer;
@@ -54,6 +60,7 @@ while (my $q = CGI::Fast->new) {
$answer{'fullname'} = $fullname;
$answer{'token'} = $token;
- print "Content-type: application/json; charset=UTF-8\n\n";
+ print "Content-type: application/json; charset=UTF-8\n";
+ print "Status: $responsecode\n\n";
print encode_json \%answer;
}