diff options
author | Christoph Burschka | 2014-01-16 15:34:03 +0100 |
---|---|---|
committer | Christoph Burschka | 2014-01-16 15:34:03 +0100 |
commit | de7b4681c953982fb8e33a5f74eb93ee8e539108 (patch) | |
tree | 4165c34d2066e1e135f050ccddc37db9beba09d7 /plugins/session/www | |
parent | Implement smf2_session and finish RPC code. (#1) (diff) | |
download | ejabberd-auth-php-de7b4681c953982fb8e33a5f74eb93ee8e539108.tar.gz |
Finished session auth framework for now. (fixes #1)
Doc changes and some implementations remain.
Diffstat (limited to 'plugins/session/www')
-rw-r--r-- | plugins/session/www/rpc.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/plugins/session/www/rpc.php b/plugins/session/www/rpc.php index fca85a0..9e27bc3 100644 --- a/plugins/session/www/rpc.php +++ b/plugins/session/www/rpc.php @@ -4,13 +4,18 @@ define('SESS_ROOT', __DIR__ . '/../'); require_once SESS_ROOT . 'main.php'; -$entry = (!empty($_POST['salt']) && strlen($_POST['salt']) >= 16) ? - create_key($_POST['salt']) : FALSE; - -if ($entry) { - header('Content-type: text/plain; charset=UTF-8'); - print json_encode($entry); +if (!empty($_POST['salt']) && strlen($_POST['salt']) >= 16) { + $entry = create_key($_POST['salt']); + if ($entry) { + header('Content-type: text/plain; charset=UTF-8'); + print json_encode($entry); + } + else { + header('HTTP/1.1 403 Forbidden'); + print json_encode(['error' => 'no-session']); + } } else { header('HTTP/1.1 403 Forbidden'); + print json_encode(['error' => 'no-request']); } |