lfiore/upld

login issue

Closed this issue · 5 comments

Hello!
I've been having some weird issues.
When I run upld in a closed environment, I have no problems at all with registering and logging in users.
But when I recreate everything on my actual webserver, I can register users, but I cannot login users. No idea why.
Also, in the database it says the wrong IP adress of the user (me in this case). I haven't done anything weird as far as I know, I use basically the exact same system in both cases.
Any idea as to why this happens?

What happens when you log in? Does it give you a blank page, or does it tell you the login details are wrong? Or does it seem like you are logged in, but never actually set up a session for you so you can't access anything?

As for the IP, is it a VPS/Dedicated server you're using, or shared hosting?

Are you using Cloudflare or any other kind of reverse proxy? If you're using Cloudflare, you need to make sure that in the config file you have define('CLOUDFLARE', true); (it's false by default). Cloudflare is the only reverse proxy that is supported. For any others, it will just give you one of the provider's IP addresses as that's where the server sees the request coming from.

If you do a WHOIS lookup on the IP address, who does it belong to? Your local ISP or your hosting provider? Or is it something completely different? Not sure what else it could be though.

When I log in it just tells me the login details are wrong.

In my closed environment I'm running a WAMPserver.
My real server is self-hosted. I'm running multiple websites on it, none with this issue.

Yes, I'm using cloudflare, that could maybe be the issue (though I don't understand why since upld just connects to the locally installed mysql server - MariaDB).

Edit: I tried changing to define('CLOUDFLARE', true); in the config, but it didn't change anything, except that it now shows my real IP. The other issues remains.

I did a WHOIS lookup and it belongs to my local ISP.

It's like upld can't connect to the database when looking up if the user exists, but has no problems writing to the database. It's really weird.

I've deleted the database and user and done everything from the beginning again (with upld). Nothing changes.

Just to clarify, the comment about Cloudflare was re: the IP being different in the database. If it goes through Cloudflare, that's the IP address that the website will see for the user (unless you set define('CLOUDFLARE', true) in which case it will verify that the IP belongs to Cloudflare, then check the HTTP_CF_CONNECTING_IP header and use that instead.

Looking at the login and registration pages, the hashing is done by PHP on registration, and then by the MySQL server when you try and log in, so I can only imagine the difference between MySQL servers is what's causing the issue.

I've pushed an update to login.php

See if that fixes your issue

Yes! That fixed the issue! Great!
Sorry for taking so long to respond, I've been busy and it slipped my mind, but it works like a charm now, thanks 😀