News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Can't Logout in Maintenance Mode

Started by zsw007, September 02, 2007, 08:29:16 AM

Previous topic - Next topic

zsw007

I put my forum in Maintenance Mode and logout and tryed to login with another account, and it came in but the forum didn't show, But when i tryed to logout with that other account, it wont let me logout... and it wont let me switch to another account(my admin account) either. :(

Elmacik

Try clearing your cookies and cache.
Do you get any error?
Home of Elmacik

zsw007

I thought it was a bug because you shouldn't be able to do anything but logout, so you should be able to logout...

greyknight17

I don't quite understand your problem in the first post, but let's see if this makes sense.

In maintenance mode, regular members will not be able to access the forum. As an administrator, you can login to the forum and see everything. It's just that on the top part where your user information is, it will say that the forum is still in maintenance mode to let you know.

Is that the question? If not, please be more specific and we will try to help you out more.

rsw686

#4
I have this problem as well. If I put the forum in maintenance mode, a regular user can still log in and the menu will show the profile, my message, logout links. However pressing log out will just refresh the page and not actually log the user out.

This is easily reproducable.

1)Take a test forum and have your admin account and another regular account.
2) Log in with the admin account and place forum in maintenance mode and log out.
3) Log in with a regular account on the maintenance screen.
4) Try and log out, notice you can't.
5) Try and log in with admin account, notice you can't.

The forum is rendered useless until you clear the cookies or use a different browser / machine to log in under admin and take it out of maintenance mode.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

rsw686

#5
To correct this the following code needs to be changed on index.php

From This:

// Is the forum in maintenance mode? (doesn't apply to administrators.)
if (!empty($maintenance) && !allowedTo('admin_forum'))
{
// You can only login.... otherwise, you're getting the "maintenance mode" display.
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'login2')
{
require_once($sourcedir . '/LogInOut.php');
return 'Login2';
}
// Don't even try it, sonny.
else
{
require_once($sourcedir . '/Subs-Auth.php');
return 'InMaintenance';
}
}


To This:

// Is the forum in maintenance mode? (doesn't apply to administrators.)
if (!empty($maintenance) && !allowedTo('admin_forum'))
{
// You can login.
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'login2')
{
require_once($sourcedir . '/LogInOut.php');
return 'Login2';
}
// Or you can logout.
elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'logout')
{
require_once($sourcedir . '/LogInOut.php');
return 'Logout';
}
// Otherwise, you're getting the "maintenance mode" display.
else
{
require_once($sourcedir . '/Subs-Auth.php');
return 'InMaintenance';
}
}


There is one issue with the correction. After you log out and go to log back in it says "Session verification failed. Please try logging out and back in again, and then try again.". So maybe somebody with more knowledge can finish fixing this.

I defiantly think you should be able to log out in maintenance mode. Otherwise that is a hassle to clear the cookies or use a different browser if your trying to log in under the admin account.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

zsw007

#6
Quote
I have this problem as well. If I put the forum in maintenance mode, a regular user can still log in and the menu will show the profile, my message, logout links. However pressing log out will just refresh the page and not actually log the user out.

This is easily reproducable.

1)Take a test forum and have your admin account and another regular account.
2) Log in with the admin account and place forum in maintenance mode and log out.
3) Log in with a regular account on the maintenance screen.
4) Try and log out, notice you can't.
5) Try and log in with admin account, notice you can't.

The forum is rendered useless until you clear the cookies or use a different browser / machine to log in under admin and take it out of maintenance mode.

Yes, that is what im talking about.

You should be able to Logout even if is maintenance mode.

And i think this should be there by defalt

codenaught

This is more or less a bug in 1.1. Here is a fix that will go into the next release of SMF, but I figured you may want to have it now :):

Open root_directory/index.php

Find:

// You can only login.... otherwise, you're getting the "maintenance mode" display.
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'login2')
{
require_once($sourcedir . '/LogInOut.php');
return 'Login2';
}


Change to:

// You can only login.... otherwise, you're getting the "maintenance mode" display.
if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'login2' || $_REQUEST['action'] == 'logout'))
{
require_once($sourcedir . '/LogInOut.php');
return $_REQUEST['action'] == 'login2' ? 'Login2' : 'Logout';
}
Dev Consultant
Former SMF Doc Coordinator

Advertisement: