Add optional info page protection.

This commit is contained in:
Lars Jung 2014-06-29 17:51:00 +02:00
parent db4932b9ce
commit 96480a5c50
7 changed files with 218 additions and 54 deletions

View file

@ -8,7 +8,7 @@ class Api {
public function __construct($app) {
$this->actions = array("get", "getThumbHref", "download", "upload", "delete", "rename");
$this->actions = array("login", "logout", "get", "getThumbHref", "download");
$this->app = $app;
$this->options = $app->get_options();
}
@ -24,6 +24,21 @@ class Api {
}
private function on_login() {
$pass = use_request_param("pass");
$_SESSION[AS_ADMIN_SESSION_KEY] = sha1($pass) === PASSHASH;
json_exit(array("as_admin" => $_SESSION[AS_ADMIN_SESSION_KEY]));
}
private function on_logout() {
$_SESSION[AS_ADMIN_SESSION_KEY] = false;
json_exit(array("as_admin" => $_SESSION[AS_ADMIN_SESSION_KEY]));
}
private function on_get() {
$response = array();