Login by ID and not by the username

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
germainperdigal
Registered User
Posts: 3
Joined: Sat Nov 10, 2018 11:30 am

Login by ID and not by the username

Post by germainperdigal »

Hi there,

I want to change my auth methode from giving the username/password to giving the user ID/password.

I checked the auth.php file ( in /phpbb/auth/auth.php ) which includes the login() function. I've found a query :

Code: Select all

$sql = 'SELECT user_id, username, user_password, user_passchg, user_pass_convert, user_email, user_type, user_login_attempts
            FROM ' . USERS_TABLE . "
            WHERE username_clean = '" . $this->db->sql_escape($username_clean) . "'";


And turned it into :

Code: Select all

$sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
                FROM ' . USERS_TABLE . "
                WHERE user_id == ' . $user_id . '";
But I'm not able to log with my ID/password.

Anyone knows how to handle a login using the user_id column ?

Thanks !
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Login by ID and not by the username

Post by Lumpy Burgertushie »

the user id is just a number. why would you want that to be the login?
what exactly is the reason you are trying to do this?

robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
germainperdigal
Registered User
Posts: 3
Joined: Sat Nov 10, 2018 11:30 am

Re: Login by ID and not by the username

Post by germainperdigal »

In fact I'm doing it for a friend, he wants to create an automatic login. No more password, just login by ID.
He just want to check if the ID exists and then connect the user.
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Login by ID and not by the username

Post by david63 »

germainperdigal wrote: Sat Nov 10, 2018 2:15 pm In fact I'm doing it for a friend, he wants to create an automatic login. No more password, just login by ID.
He just want to check if the ID exists and then connect the user.
So you are saying that to login to the board all you want the users to do is enter their user id. If that is the case then there are two issues;

1. Users will not know their user ID.

2. You will have every spammer on the planet spamming your board once they realise that you only have to enter a number. Not only that if someone entered the value "2" they would have Admin access
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
germainperdigal
Registered User
Posts: 3
Joined: Sat Nov 10, 2018 11:30 am

Re: Login by ID and not by the username

Post by germainperdigal »

I know, and I agree with you but this is his idea and I wanted to know if it was possible ?
User avatar
warmweer
Jr. Extension Validator
Posts: 11234
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: Login by ID and not by the username

Post by warmweer »

germainperdigal wrote: Sat Nov 10, 2018 2:30 pm I know, and I agree with you but this is his idea and I wanted to know if it was possible ?
Actually it's a relatively simple concept: A new user automatically gets the next unused user_id, so while processing the registration, the next available user_id could be shown and automatically inserted into the username field. From then on registration could continue without having to change code (I think). The code should be relatively simple, but there are a few items to check:
new users A and B might try to register at approximately the same time, so user_id for A should be blocked as soon as the login_page is reached so that user B gets user_id_A +1 and not user_id_A which can't process (unless B submits before A, in which case A would have to restart registration).

A much more simple way would be to inform a registrant (upon registration) that the name he uses to register will automatically be changed to his user_id upon processing the registration.

But I seriously can't think of a valid reason in using a user_id as username, on the contrary, there are reasons enough not not allow usernames that are plain numerical (long integers).
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Login by ID and not by the username

Post by Lumpy Burgertushie »

I don't think the op was talking about registration. he was talking about logging in at any time only using the user id number.

although possible ( basically anything is possible ), it is not a good idea at all. as mentioned above, all spammers, hackers would have to do to login would be to put in any number they wish to be able to log into the board. as mentioned above, even the number 2 , which is always the founder/installer's user id by default.

doing something like this is bypassing the security system of the board and nobody here is likely to help you do that.

just not a good idea. tell your friend to think of something else.


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
Post Reply

Return to “phpBB Custom Coding”