mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-10 10:04:01 +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 {object} options - options for the modal ({ large: false })
|
||||
*/
|
||||
this.showModal = function( content, options ) {
|
||||
this.showModal = function( content, options, modal_options ) {
|
||||
options = options || {};
|
||||
let modal = document.createElement( 'div' );
|
||||
modal.classList.add( 'modal' );
|
||||
@@ -66,6 +66,7 @@ function IFM(params) {
|
||||
formElements.first().focus();
|
||||
}
|
||||
})
|
||||
.modal(modal_options)
|
||||
.modal('show');
|
||||
};
|
||||
|
||||
@@ -1906,7 +1907,10 @@ function IFM(params) {
|
||||
dataType: "json",
|
||||
success: function(d) {
|
||||
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;
|
||||
form.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
11
src/main.php
11
src/main.php
@@ -188,11 +188,8 @@ f00bar;
|
||||
case "getI18N":
|
||||
return $this->getI18N($_REQUEST);
|
||||
case "logout":
|
||||
$session_name = basename($this->config['root_dir']);
|
||||
session_set_cookie_params(0, "/{$session_name}/");
|
||||
session_start(['cookie_path' => "/{$session_name}/",'name' => $session_name,]);
|
||||
session_start();
|
||||
unset($_SESSION);
|
||||
session_destroy();
|
||||
header("Location: " . strtok($_SERVER["REQUEST_URI"], '?'));
|
||||
exit;
|
||||
}
|
||||
@@ -997,9 +994,9 @@ f00bar;
|
||||
}
|
||||
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||
$session_name = basename($this->config['root_dir']);
|
||||
session_set_cookie_params(0, "/{$session_name}/");
|
||||
session_start(['cookie_path' => "/{$session_name}/",'name' => $session_name,]);
|
||||
$cookie_path = dirname($_SERVER['REQUEST_URI']);
|
||||
session_set_cookie_params(0, $cookie_path);
|
||||
session_start(['cookie_path' => $cookie_path]);
|
||||
}
|
||||
|
||||
if (isset($_SESSION['ifmauth']) && $_SESSION['ifmauth'] == true)
|
||||
|
Reference in New Issue
Block a user