mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-13 03:23:59 +02:00
Fix login and logout
Signed-off-by: Marco Dickert <marco@misterunknown.de>
This commit is contained in:
@@ -33,7 +33,7 @@ function IFM(params) {
|
|||||||
* @param {string} content - HTML content of the modal
|
* @param {string} content - HTML content of the modal
|
||||||
* @param {object} options - options for the modal ({ large: false })
|
* @param {object} options - options for the modal ({ large: false })
|
||||||
*/
|
*/
|
||||||
this.showModal = function( content, options ) {
|
this.showModal = function( content, options, modal_options ) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
let modal = document.createElement( 'div' );
|
let modal = document.createElement( 'div' );
|
||||||
modal.classList.add( 'modal' );
|
modal.classList.add( 'modal' );
|
||||||
@@ -66,6 +66,7 @@ function IFM(params) {
|
|||||||
formElements.first().focus();
|
formElements.first().focus();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.modal(modal_options)
|
||||||
.modal('show');
|
.modal('show');
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1906,7 +1907,10 @@ function IFM(params) {
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(d) {
|
success: function(d) {
|
||||||
if (d.status == "ERROR") {
|
if (d.status == "ERROR") {
|
||||||
self.showModal(Mustache.render(self.templates.login, {i18n: self.i18n}), {large: true});
|
self.showModal(Mustache.render(self.templates.login, {i18n: self.i18n}), {large: true}, {
|
||||||
|
backdrop: 'static',
|
||||||
|
keyboard: false
|
||||||
|
});
|
||||||
var form = document.forms.loginForm;
|
var form = document.forms.loginForm;
|
||||||
form.addEventListener('click', function(e) {
|
form.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
11
src/main.php
11
src/main.php
@@ -188,11 +188,8 @@ f00bar;
|
|||||||
case "getI18N":
|
case "getI18N":
|
||||||
return $this->getI18N($_REQUEST);
|
return $this->getI18N($_REQUEST);
|
||||||
case "logout":
|
case "logout":
|
||||||
$session_name = basename($this->config['root_dir']);
|
session_start();
|
||||||
session_set_cookie_params(0, "/{$session_name}/");
|
|
||||||
session_start(['cookie_path' => "/{$session_name}/",'name' => $session_name,]);
|
|
||||||
unset($_SESSION);
|
unset($_SESSION);
|
||||||
session_destroy();
|
|
||||||
header("Location: " . strtok($_SERVER["REQUEST_URI"], '?'));
|
header("Location: " . strtok($_SERVER["REQUEST_URI"], '?'));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -997,9 +994,9 @@ f00bar;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (session_status() !== PHP_SESSION_ACTIVE) {
|
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||||
$session_name = basename($this->config['root_dir']);
|
$cookie_path = dirname($_SERVER['REQUEST_URI']);
|
||||||
session_set_cookie_params(0, "/{$session_name}/");
|
session_set_cookie_params(0, $cookie_path);
|
||||||
session_start(['cookie_path' => "/{$session_name}/",'name' => $session_name,]);
|
session_start(['cookie_path' => $cookie_path]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_SESSION['ifmauth']) && $_SESSION['ifmauth'] == true)
|
if (isset($_SESSION['ifmauth']) && $_SESSION['ifmauth'] == true)
|
||||||
|
Reference in New Issue
Block a user