summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README5
-rwxr-xr-xrh-bin/authtoken.json (renamed from authtoken.json)15
-rw-r--r--www/js/auth.js2
3 files changed, 11 insertions, 11 deletions
diff --git a/README b/README
index 0ec53aa..30c0845 100644
--- a/README
+++ b/README
@@ -30,7 +30,7 @@ LICENSE
Installation
============
-# sudo aptitude install apache2 libapache2-mod-perl2 libconfig-inifiles-perl libdbd-mysql-perl librhrd-perl libjs-jquery rivendell-server
+# sudo aptitude install apache2 libapache2-mod-perl2 libconfig-inifiles-perl libdbd-mysql-perl libjson-pp-perl librhrd-perl libjs-jquery rivendell-server
# sudo a2enmod ssl authnz_ldap perl proxy_wstunnel
# sudo /etc/init.d/apache2 restart
@@ -69,8 +69,7 @@ add the following to the virtualhost config:
Require all granted
</Location>
- Alias /authtoken.json /var/www/rhwebimport/authtoken.json
- <Location /authtoken.json>
+ <Location /rh-bin/authtoken.json>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
diff --git a/authtoken.json b/rh-bin/authtoken.json
index 12e390f..f746518 100755
--- a/authtoken.json
+++ b/rh-bin/authtoken.json
@@ -22,6 +22,7 @@
use strict;
use RHRD::rddb;
+use JSON;
my $status = 'ERROR';
my $errorstring = 'unknown';
@@ -40,11 +41,11 @@ if(defined $ENV{REMOTE_USER}) {
$errorstring = 'no username defined - are you logged in?';
}
-print "Content-type: application/json; charset=UTF-8\n\n";
+my %answer;
+$answer{'status'} = $status;
+$answer{'errorstring'} = $errorstring;
+$answer{'username'} = $username;
+$answer{'token'} = $token;
-print "{\n";
-print ' "status": "' . $status . '"'. ",\n";
-print ' "errorstring": "' . $errorstring . '"'. ",\n";
-print ' "username": "' . $username . '"' . ",\n";
-print ' "token": "' . $token . '"' . "\n";
-print "}\n";
+print "Content-type: application/json; charset=UTF-8\n\n";
+print encode_json \%answer;
diff --git a/www/js/auth.js b/www/js/auth.js
index 44adc6f..8da85c8 100644
--- a/www/js/auth.js
+++ b/www/js/auth.js
@@ -51,7 +51,7 @@ function auth_loginError(req, status, error) {
}
function auth_login() {
- $.ajax("/authtoken.json",
+ $.ajax("/rh-bin/authtoken.json",
{ cache: false,
username: $("#username").val(),
password: $("#password").val(),