Page 1 of 2

Can no longer log into admin panel

Posted: Sun May 07, 2017 6:47 pm
by wmdvanzyl
Hi All.

I can't seem to log in to the admin panel on this website.

I have tried the following possible solutions without success:
* Forgot password link (even though email sending is set up and working)
* Reset password in database (newest version as found here)
* Clearing cache inside tmp folder on server
* Clearing browser cache

None of these have worked. Trying to log in doesn't even give an error, it just reloads the page.

Any advice would be much, much appreciated!

Re: Can no longer log into admin panel

Posted: Sun May 07, 2017 6:55 pm
by Rolf
Just wondering, do you use the AdminIPLock module to secure your backend?

Re: Can no longer log into admin panel

Posted: Sun May 07, 2017 7:09 pm
by wmdvanzyl
Hi Rolf. Good question. Unfortunately, in South Africa, we don't have the luxury of static IP's, so it's very difficult for me to do that.

EDIT: Is there anything else i can try to regain access?

EDIT: How can i add a user with SQL? How would i alter this query?

Code: Select all

update cms_users set password = (select md5(CONCAT(IFNULL((SELECT sitepref_value FROM cms_siteprefs WHERE sitepref_name = 'sitemask'),''),'NEW_PASSWORD'))) where username = 'USER_NAME'

Re: Can no longer log into admin panel

Posted: Sun May 07, 2017 7:32 pm
by Rolf
So, you don't use that or a similar module...

At the moment I can only think of trying to login from another computer. Maybe there is still some kind of caching thingy around...

Now that I think of it. When you tried to log in and the Login screen appears again. Just try to open yourwebsite.com/admin/index.php What happens than?

Re: Can no longer log into admin panel

Posted: Sun May 07, 2017 7:36 pm
by Jo Morg
@wmdvanzyl: may I ask what version of CMSMS are you running?

Re: Can no longer log into admin panel

Posted: Sun May 07, 2017 8:03 pm
by wmdvanzyl
Jo Morg wrote:@wmdvanzyl: may I ask what version of CMSMS are you running?
2.1.6

@Rolf - I have tried different browsers - i will try different computers next. And there's no defacing or unwanted files. I can access the files on the server and the database and everything is fine. I just can't access the backend. The site also looks fine.

Re: Can no longer log into admin panel

Posted: Sun May 07, 2017 8:10 pm
by Rolf
Rolf wrote:Now that I think of it. When you tried to log in and the Login screen appears again. Just try to open yourwebsite.com/admin/index.php What happens than?

Re: Can no longer log into admin panel

Posted: Sun May 07, 2017 8:10 pm
by Jo Morg
wmdvanzyl wrote:
Jo Morg wrote:@wmdvanzyl: may I ask what version of CMSMS are you running?
2.1.6
Then try the following:
  • - try to login once and wait for the page to reload;
  • - if the login page reloads without an error then it means that you ARE logged in, but that the redirection just didn't occur, so try to access the url: <siteroot>/admin immediately after the attempt to login;
If that works, it means that you have run into a rare conjugation of factors that trigger a minor bug on login redirection. IIRC it has been fixed for CMSMS 2.2.

Re: Can no longer log into admin panel

Posted: Sun May 07, 2017 8:12 pm
by Jo Morg
Well yeah that was what I was thinking but, RolfTJ, you just beat me to it... :)

Re: Can no longer log into admin panel

Posted: Sun May 07, 2017 8:41 pm
by wmdvanzyl
Rolf wrote:
Rolf wrote:Now that I think of it. When you tried to log in and the Login screen appears again. Just try to open yourwebsite.com/admin/index.php What happens than?
Sorry Rolf, i forgot to respond to this one. It just leaves me back at the login page. Can i PM you the username an password to see for yourself?

EDIT: I apologise if it sounded as if i want you to solve my issue for me. That was not my intention. I just don't know if i am expressing all the details correctly.

Re: Can no longer log into admin panel

Posted: Mon May 08, 2017 6:54 am
by wmdvanzyl
Contents of config.php just for reference:

Code: Select all

<?php
# CMS Made Simple Configuration File
# Documentation: /doc/CMSMS_config_reference.pdf
#
$config['debug'] = false;
$config['timezone'] = 'Africa/Johannesburg';
$config['dbms'] = 'mysql';
$config['db_hostname'] = 'localhost';
$config['db_username'] = '*****';
$config['db_password'] = '*****';
$config['db_name'] = '*****';
$config['db_prefix'] = 'cms_';
$config['admin_dir'] = 'admin';
$config['url_rewriting'] = 'mod_rewrite';
$config['permissive_smarty'] = 1;
$config['root_url'] = 'https://modh.co.za';
?>

Re: Can no longer log into admin panel

Posted: Mon May 08, 2017 7:10 am
by wmdvanzyl
*** UPDATE ***
I noticed that pretty URL's were also not working. So i headed to .htaccess to investigate.

I commented out everything except the pretty URL parts and voila! I have access to backend!

Code: Select all

# Rewrites urls in the form of /parent/child/grandchild but only rewrites if the requested URL is not a file or directory.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>

# Link to www.modh.co.za then redirect to modh.co.za
#RewriteCond %{HTTP_HOST} ^www\.modh\.co\.za [NC]              
#RewriteRule ^(.*)$ https://modh.co.za/$1 [L,R=301]

# Link to http://website,com then redirect to http://www.website.com
#RewriteCond %{HTTP_HOST} ^modh\.co\.za [NC]
#RewriteRule ^(.*)$ https://www.modh.co.za/$1 [L,R=301]

# Force HTTPS
#RewriteCond %{HTTPS} !=on
#RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
I'm guessing one of those rules aren't correct or they are clashing. I am not an Apache redirect expert to say the least! ::)

Re: Can no longer log into admin panel

Posted: Mon May 08, 2017 7:47 am
by velden
If you have root_url and or admin_url defined in config.php then make sure they have the proper values (starting with https://www.modh.co.za)

Code: Select all

# Link to www.modh.co.za then redirect to modh.co.za
#RewriteCond %{HTTP_HOST} ^www\.modh\.co\.za [NC]             
#RewriteRule ^(.*)$ https://modh.co.za/$1 [L,R=301]

# Link to http://website,com then redirect to http://www.website.com
#RewriteCond %{HTTP_HOST} ^modh\.co\.za [NC]
#RewriteRule ^(.*)$ https://www.modh.co.za/$1 [L,R=301]
I'm kind of surprised this doesn't cause a redirection loop..

If it starts with www. then remove the www. and then if it doesn't start with www. then redirect to www. To me it seems like a loop condition. But I might be missing something here.

Re: Can no longer log into admin panel

Posted: Mon May 08, 2017 7:56 am
by Rolf
The SSL/www redirect rules in this post work for me
https://www.cmscanbesimple.org/blog/set ... ade-simple

Re: Can no longer log into admin panel

Posted: Mon May 08, 2017 8:13 am
by wmdvanzyl
velden wrote: I'm kind of surprised this doesn't cause a redirection loop..
You are correct sir, but i only had one uncommented. I had just pasted both in from the docs and then decided to use the non-www route, so i commented the other one out.

;D
Rolf wrote:The SSL/www redirect rules in this post work for me
https://www.cmscanbesimple.org/blog/set ... ade-simple
Thanks Rolf - your blog is invaluable!

I think the problem lies with that "Force https" rule. I already have https set on all the content pages and i have all the certificates in place. So perhaps that rule isn't necessary. I will test it a bit later. For now keeping that rule out gives me access and that make me very, very happy.