TinyPortal

Development => Support => Topic started by: @rjen on March 12, 2022, 03:03:47 PM

Title: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 12, 2022, 03:03:47 PM
Guys, question

I upgraded my forum to 2.1 today. TinyPortal on it, now I am getting a 404 error everytime after loggin in. After that all works fine, but when logging out and logging in same error again.

I see nothing in the logs.
When I uninstall TP the issue is gone. Reinstalled and it is back.

It seems to me that the redirect from logging in is somehow wrong. I tried both options: forum or Frontpage, but makes no difference

Forum is on https ….

Any ideas where to look ?
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: tino on March 12, 2022, 03:22:19 PM
Log in via standard link or the one in the user block?
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 12, 2022, 03:25:30 PM
the standard links
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: tino on March 12, 2022, 03:35:52 PM
What version of PHP?

Can’t replicate this atm. Logs in ok via the login box at the top of the screen.

Any errors shown anywhere when getting the 404? Does the login url look correct in the inspector?
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 12, 2022, 03:37:45 PM
No errors, PHP 7.4. Need to check tomorrow, going to sleep now...
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 12, 2022, 03:41:37 PM
Would you mind trying it here for yourself?

https://test.fjr-club.nl/

User: "test forumlid"
Password: testtest

Then you can see what I see...
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: lurkalot on March 12, 2022, 04:34:39 PM
I'm not seeing any error using that test account.  Logged in and out a couple of times without issue.

Maybe a browser issue, have you tried a different one just in case. I'm using Edge.
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 13, 2022, 01:31:02 AM
You are not getting this screen after login? It’s a custom 404 , and I am getting it in all browsers as well on my pc as on mobile…

Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: tino on March 13, 2022, 03:16:04 AM
You are not getting this screen after login? It’s a custom 404 , and I am getting it in all browsers as well on my pc as on mobile…

I get the same on my mobile. I’ll try it on my desktop later today and try and see where it’s breaking.
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 13, 2022, 03:19:53 AM
Thanks, it has been driving me nuts! And it seems it is something that does not happen to everyone , so may have some relation to user permissions or settings
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: tino on March 13, 2022, 04:18:10 AM
Thanks, it has been driving me nuts! And it seems it is something that does not happen to everyone , so may have some relation to user permissions or settings

It's something around the SESSION can you add some logging to see the value of this variable

https://github.com/SimpleMachines/SMF2.1/blob/acee5b182b8f692c99fb4c6af08eb1d0258a4cfe/Sources/LogInOut.php#L208

I think that isn't correctly set sometimes, although what it is set to I can't see without access to the SESSION.

You can log to the database so that it isn't visible to uses doing this

Code: [Select]
log_error(var_export($_SESSION, true), 'general', __FILE__, __LINE__);
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: tino on March 13, 2022, 04:20:53 AM
A bit more information.

If I clear out the cache for saved cookies then I can login without issues. If I login then logout then login again I get a 404.
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 13, 2022, 04:45:56 AM
Thanks, it has been driving me nuts! And it seems it is something that does not happen to everyone , so may have some relation to user permissions or settings

It's something around the SESSION can you add some logging to see the value of this variable

https://github.com/SimpleMachines/SMF2.1/blob/acee5b182b8f692c99fb4c6af08eb1d0258a4cfe/Sources/LogInOut.php#L208

I think that isn't correctly set sometimes, although what it is set to I can't see without access to the SESSION.

You can log to the database so that it isn't visible to uses doing this

Code: [Select]
log_error(var_export($_SESSION, true), 'general', __FILE__, __LINE__);

Never done this before. Where do you want me to add the code? And where will it log to?
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: tino on March 13, 2022, 01:32:38 PM
Add it on this line; https://github.com/SimpleMachines/SMF2.1/blob/acee5b182b8f692c99fb4c6af08eb1d0258a4cfe/Sources/LogInOut.php#L113

It will log to the standard SMF error log so you can see it when you go to error log.
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 13, 2022, 02:20:56 PM
Ok, I got two errors logged.

Error 1:

Guest
2a02:a213:a701:c080:e978:66ac:9e70:3ea9
7bcc369c36a349f51387be22248460a2
https://test.fjr-club.nl/index.php?action=login2;ajax
/home/deb77453/domains/fjr-club.nl/public_html/test/Sources/LogInOut.php (Line 113) 

error message:
Code: [Select]
array (
'session_value' => '7bcc369c36a349f51387be22248460a2',
'session_var' => 'de5650b093',
'token' =>
array (
'post-login' =>
array (
0 => 'b85b266',
1 => 'b5b654cb385ea09acf919a1cdde7bb31',
2 => 1647202700,
3 => 'f0fe2c52eed3b0e0e53adad7d0c9a7ed',
),
),
'robot_check' => 1647202696,
'mc' =>
array (
'time' => 1647202696,
'id' => 0,
'gq' => '0=1',
'bq' => '0=1',
'ap' =>
array (
),
'mb' =>
array (
),
'mq' => '0=1',
),
'ban' =>
array (
'last_checked' => 1647202696,
'id_member' => 0,
'ip' => '2a02:a213:a701:c080:e978:66ac:9e70:3ea9',
'ip2' => '2a02:a213:a701:c080:e978:66ac:9e70:3ea9',
'email' => '',
),
'log_time' => 1647202696,
'timeOnlineUpdated' => 1647202696,
'old_url' => 'https://test.fjr-club.nl/index.php?action=login;ajax',
'USER_AGENT' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36',
'login_url' => 'https://test.fjr-club.nl/index.php?page=404-Pagina-niet-gevonden',
)

Error 2:
@rjen
2a02:a213:a701:c080:e978:66ac:9e70:3ea9
7bcc369c36a349f51387be22248460a2
https://test.fjr-club.nl/index.php?action=login2;sa=check;member=3
/home/deb77453/domains/fjr-club.nl/public_html/test/Sources/LogInOut.php (Line 113)

Code: [Select]
array (
'session_value' => '7bcc369c36a349f51387be22248460a2',
'session_var' => 'de5650b093',
'token' =>
array (
'post-login' =>
array (
0 => 'da1989b4637',
1 => 'eec50f921f99e4e80f16a7ab2b0e3fe0',
2 => 1647202703,
3 => '8184085d2eb075ec9d3a8c04e7006e0c',
),
),
'robot_check' => 1647202696,
'mc' =>
array (
'time' => 1647202704,
'id' => 3,
'gq' => '1=1',
'bq' => '1=1',
'ap' =>
array (
0 => 0,
),
'mb' =>
array (
),
'mq' => '0=1',
),
'ban' =>
array (
'last_checked' => 1647202696,
'id_member' => 0,
'ip' => '2a02:a213:a701:c080:e978:66ac:9e70:3ea9',
'ip2' => '2a02:a213:a701:c080:e978:66ac:9e70:3ea9',
'email' => '',
),
'log_time' => 1647202704,
'timeOnlineUpdated' => 1647202696,
'old_url' => 'https://test.fjr-club.nl/index.php?action=login2;ajax',
'USER_AGENT' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36',
'login_url' => 'https://test.fjr-club.nl/index.php?page=404-Pagina-niet-gevonden',
'login_SMFCookie202110' => '{"0":3,"1":"724456a316016e9aca1b175ad59fa5e468652aed3199de4d756596d14b04bb89baf278266e2f4e3a3b0a2032b9f51da4a085f4f20f5b5acfafb782d1444ec601","2":1649794704,"3":"","4":"\\/"}',
'id_msg_last_visit' => '373871',
'rc' =>
array (
'id' => 3,
'time' => 1647202704,
'reports' => '0',
'member_reports' => '0',
),
)
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: tino on March 13, 2022, 03:38:04 PM
The login_url is set to 404 page, question is why.
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 13, 2022, 03:40:56 PM
Yeah … that’s the question
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: tino on March 13, 2022, 03:53:07 PM
How do you set that custom 404 page?

My guess is it’s something related to that.

The fact it’s only on a old session not a fresh one suggests that the url somehow isn’t being cleared.
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 14, 2022, 03:37:59 AM
I seems that I fixed it now...

the custom 404 was referred to in the .htaccess file:

Code: [Select]
GeoIPEnable On     
SetEnvIf GEOIP_COUNTRY_CODE CN DenyCountry 
SetEnvIf GEOIP_COUNTRY_CODE_V6 CN DenyCountry
SetEnvIf GEOIP_COUNTRY_CODE A1 DenyCountry 
SetEnvIf GEOIP_COUNTRY_CODE_V6 A1 DenyCountry
order allow,deny
deny from env=DenyCountry
deny from 220.243.
deny from 46.229.168.
allow from all
   
ErrorDocument 404 /index.php?page=404-Pagina-niet-gevonden

RewriteEngine on

# Automatisch doorsturen naar UNDER_CONSTRUCTION behalve bepaalde IP adressen ONDERHOUD
# RewriteCond %{REMOTE_ADDR} !^216.131.88.190$
# RewriteCond %{REQUEST_URI} !=/under_construction.html
# RewriteCond %{REQUEST_FILENAME} !.(gif|jpe?g|png)$
# RewriteRule ^ http://test.fjr-club.nl/under_construction.html [R=307,L]

# Automatisch doorsturen naar SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
....


The line: ErrorDocument 404 /index.php?page=404-Pagina-niet-gevonden

After I removed that it seems that the login error is not happening anymore...

Now for the 64000 $ question: this page reference has been in my .htaccess for ages, and it worked fine...

For the books...
1. What has changed now?
2. And why does it only create problems when TinyPortal is installed...?

We may never know, but still...
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 14, 2022, 03:46:55 AM
Just for the record: when I login now the logged message does not hold a login-URL anymore...

Error 1:
Code: [Select]
array (
'session_value' => 'e1d9d3aab403473defc8ed11b3887e8b',
'session_var' => 'a97eae7f210',
'token' =>
array (
'post-login' =>
array (
0 => 'c7974be513',
1 => 'efb038d21b62497375e2caa03fb7012f',
2 => 1647251080,
3 => 'b0fe54b6d4e51212bea4e6538e70b27c',
),
),
'robot_check' => 1647251075,
'mc' =>
array (
'time' => 1647251075,
'id' => 0,
'gq' => '0=1',
'bq' => '0=1',
'ap' =>
array (
),
'mb' =>
array (
),
'mq' => '0=1',
),
'ban' =>
array (
'last_checked' => 1647251075,
'id_member' => 0,
'ip' => '2a02:a213:a701:c080:bdf3:7499:e9f1:b65e',
'ip2' => '2a02:a213:a701:c080:bdf3:7499:e9f1:b65e',
'email' => '',
),
'log_time' => 1647251075,
'timeOnlineUpdated' => 1647251075,
'old_url' => 'https://test.fjr-club.nl/index.php?action=login;ajax',
'USER_AGENT' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36',
)

Error 2:
Code: [Select]
array (
'session_value' => 'e1d9d3aab403473defc8ed11b3887e8b',
'session_var' => 'a97eae7f210',
'token' =>
array (
'post-login' =>
array (
0 => 'b97407bfcf',
1 => '25b29238d058088378a88b58d77b57ca',
2 => 1647251082,
3 => '683c2683c7e522ceda22325e33086ed8',
),
),
'robot_check' => 1647251075,
'mc' =>
array (
'time' => 1647251083,
'id' => 3,
'gq' => '1=1',
'bq' => '1=1',
'ap' =>
array (
0 => 0,
),
'mb' =>
array (
),
'mq' => '0=1',
),
'ban' =>
array (
'last_checked' => 1647251075,
'id_member' => 0,
'ip' => '2a02:a213:a701:c080:bdf3:7499:e9f1:b65e',
'ip2' => '2a02:a213:a701:c080:bdf3:7499:e9f1:b65e',
'email' => '',
),
'log_time' => 1647251083,
'timeOnlineUpdated' => 1647251075,
'old_url' => 'https://test.fjr-club.nl/index.php?action=login2;ajax',
'USER_AGENT' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36',
'login_SMFCookie202110' => '{"0":3,"1":"f10e7b93e26becaf50faec1288136cbb9c0c9676e5b5a8f8a46e147f5e53cabdc87472a1a66dc9883c5f46dfb533fa2911ae611f7ce7cd6ebff51567d4dfa634","2":1836467082,"3":"","4":"\\/"}',
'id_msg_last_visit' => '373871',
'rc' =>
array (
'id' => 3,
'time' => 1647251083,
'reports' => '0',
'member_reports' => '0',
),
)
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: tino on March 14, 2022, 04:30:24 PM
Why is it only an issue when TinyPortal is installed is due to the fact that SMF redirects to the forum page if it doesn’t know what the action does. (In most cases) so you wouldn’t see it if that wasn’t installed.

Why it’s an issue now is most likely as the login auth has been changed around a bit for SMF 2.1
Title: Re: SMF 2.1 redirect 404 error on login with TP
Post by: @rjen on March 15, 2022, 12:30:29 AM
I guess that reporting it with SMF will not result in a fix, since it only acts up with TP.

Let’s hope there are not many TP forums around that implemented a custom 404 message this way…