Jump to content

Prepend part of User Name when logging in


strandoo
 Share

Recommended Posts

Hello ProcessPeople. I need some help, please: I've built a site that's mainly a catalogue of products, but certain approved Dealers can login to gain access to dealer-related stuff (mainly place orders with the manufacturer). Each Dealer is pre-assigned a username in the form of Country Code and Number (UK-12345, FR-56789, etc). I'm using this with the LoginRegister module and it works well.

Not content with this simple setup, the client would like me to modify the login so that the Dealer only types the numeric part of the Username (12345) and have the Country Code (UK-) invisibly prepended to the user-supplied part when the Submit button is clicked. The user's Country Code is captured when they first arrive at the site with an IP-based geolocation service, so getting the Country Code is easy.

Is there a way to hook into the ProcessLogin module (or the LoginRegister module) to quietly insert the Country Code? I'm still a bit new to hooks. Thanks for any suggestions.

Link to comment
Share on other sites

2 hours ago, strandoo said:

The user's Country Code is captured when they first arrive at the site with an IP-based geolocation service, so getting the Country Code is easy.

So if a UK user is on a business trip in FR he/she can not log in any more with his/her UK-1234 login?

  • Like 1
Link to comment
Share on other sites

@bernhard Good question. There’s also a drop-down ‘region’ selector in the navbar to select your region. Presumably, once the new system is instigated, there will also be text on the login page along the lines of “Please ensure your region matches yadda yadda.”

The site is live; the log in is the DealerNet link in the footer: https://teak.com. (Regions are currently limited to 3.)

Link to comment
Share on other sites

Is the number part of the username unique to each user? If so, why complicate things with the region part at all? Especially if you only want the user to enter the number. I fear that by asking too much of the user (making sure their region matches), it will just lead to more tech support enquiries.

Link to comment
Share on other sites

@LMD I think the number part may not be unique. In any case, that user name format pre-dates the website. It’s what the company has been using for customer/dealer ID numbers for years and they are part of their internal ordering system. I agree that what they want complicates things. But the idea to hide the country code comes from the company’s Managing Director, so I’ve got to try to implement it. 😮💨

Link to comment
Share on other sites

@strandoo without brainstorming a lot, you could setup an hidden pre-filled field. You certainly want to use `processLoginForm()` and optionnaly `loginSuccess()` hooks. Example there on this old thread, feel free to ask for help:

 

 

Edit: I highly suggest you to buy a license for the Pro version if your project can afford it, the module is safe, but when dealing with secure access, you want something maintained. You will have possibility to ask ryan directly, and it's a way of "sponsoring" Ryan dev, without speaking of the benefit to the community.

   👆  ... comes from the company’s Managing Director (you want to keep a good reputation 😁)

That was my positive comment of the day 🙂

Edited by flydev
pro module suggestion
  • Like 1
Link to comment
Share on other sites

On 8/14/2023 at 4:52 PM, strandoo said:

I think the number part may not be unique.

In this case, you really need to ensure the user has the correct country code, otherwise there is a scenario where they could login to somebody else's account by accident!

How about pre-filling the field, but not making it invisible, so the user can see and check it is correct? Maybe with a little country flag icon?

Link to comment
Share on other sites

@LMD Yes, that's a great point. I'll check with the client to see if they are unique or not. Either way though, if the user fails to log in, the change/recover password system could be amended to include instructions i.e. 'Please ensure that you have selected your original country yada yada...' But I still think the requested changes will make things more complicated than they need to be.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...