Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login issue #16

Closed
goldug opened this issue Jun 20, 2022 · 5 comments
Closed

login issue #16

goldug opened this issue Jun 20, 2022 · 5 comments

Comments

@goldug
Copy link

goldug commented Jun 20, 2022

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?

@lfiore
Copy link
Owner

lfiore commented Jun 20, 2022

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.

@goldug
Copy link
Author

goldug commented Jun 22, 2022

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.

@goldug
Copy link
Author

goldug commented Jun 22, 2022

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

@lfiore
Copy link
Owner

lfiore commented Jun 23, 2022

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

@goldug
Copy link
Author

goldug commented Jul 5, 2022

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 😀

@goldug goldug closed this as completed Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants