Login with email. works but ACP doesn't.

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
blackshtormx
Registered User
Posts: 5
Joined: Fri Nov 30, 2018 1:06 pm

Login with email. works but ACP doesn't.

Post by blackshtormx » Fri Dec 07, 2018 1:05 pm

So i changed Login function in db.php, i use new sql query,
it used to be

Code: Select all

WHERE username_clean = '" . $this->db->sql_escape($username_clean) . "'

now it is:

Code: Select all

WHERE user_email = '" . $this->db->sql_escape($username_clean) . "'";
And it works fine, users can login with email successfully, but admin ACP has separate, second login, where it asks "To administer the board you must re-authenticate yourself."
And here comes the error, it looks like admin re authentication somewhere in engine checks first whether Current username = username from textbox, if not it will throw error. If yes, it will continue with $auth->login() function. But as i changed $auth-login() to login with email, now, admin can't re authenticate. because, obviously i have to log in with email, but (as my guess is) engine checks whether username is correct and obviously its not.
And after trying to log in with email i get error: "You are not able to re-authenticate as a different user."

So i had a perfect idea popped up, and now in login function in db.php, i check like this:

Code: Select all

$sql = 'SELECT * FROM ' . USERS_TABLE . "
			WHERE user_email = '" . $this->db->sql_escape($username_clean) . "' OR username_clean = '" . $this->db->sql_escape($username_clean) . "'";
That looks like best idea and fix ever, but it doesnt work too. I get error: "You have specified an incorrect username"
if i disable login with email, i can successfully log in into ACP. but i want with email.
how to fix? help pls

User avatar
AmigoJack
Registered User
Posts: 5479
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Login with email. works but ACP doesn't.

Post by AmigoJack » Fri Dec 07, 2018 5:32 pm

blackshtormx wrote:
Fri Dec 07, 2018 1:05 pm
a perfect idea popped up
So perfect it has been an idea before: Allow logging in with email address, in addition to username
blackshtormx wrote:
Fri Dec 07, 2018 1:05 pm
I get error: "You have specified an incorrect username"
How about debugging what your SQL query actually returns? The whole concept is to only return one result or none, but you modified it in a way it can return more than one.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

blackshtormx
Registered User
Posts: 5
Joined: Fri Nov 30, 2018 1:06 pm

Re: Login with email. works but ACP doesn't.

Post by blackshtormx » Mon Dec 10, 2018 10:56 am

AmigoJack wrote:
Fri Dec 07, 2018 5:32 pm
blackshtormx wrote:
Fri Dec 07, 2018 1:05 pm
a perfect idea popped up
So perfect it has been an idea before: Allow logging in with email address, in addition to username
blackshtormx wrote:
Fri Dec 07, 2018 1:05 pm
I get error: "You have specified an incorrect username"
How about debugging what your SQL query actually returns? The whole concept is to only return one result or none, but you modified it in a way it can return more than one.
In my forum its impossible to have 2 users with same email(i register them from different website). so only 1 row is result. My question is that i can't understand how to modify phpb code to allow ACP login with email.

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: No registered users and 1 guest