3
votes

I want to extend the FOSUserBundle to allow people to register and log in with their telephone number.

I have added the extra (tel_number) field to the entity/table.

I'm not really bothered with the registration side as I can just manually add the extra DB field in my registration form (if the user provides their phone number).

I am trying to understand what happens, and which files are used when I submit a login form (when it goes to login-check). Which file is this, where do I extend it?

If I know that then I can probably play around and get going, but I don't really get how that works. The route doesn't seem to link to anything, and I know it only works if you post to the page, GET does nothing.

So the idea would be that everyone would enter username and email, but optionally they could enter their telephone number. When logging in they can either enter username or phone number, but the key thing for me is understand where to start and intercept the login submit part.

If somebody could point out the file and process that runs when they go to login-check that would help me start looking at this. Thanks in advance.

1

1 Answers

2
votes

I think you should take a look here: https://github.com/FriendsOfSymfony/FOSUserBundle/blob/1.2.x/Resources/doc/logging_by_username_or_email.md.

More precisely to the part called "Extending the UserManager class". This is a method to implement login with email address, I'm pretty sure you can do the same using a phone number. You will probably have to define your own "findByUsernameOrPhoneNumber()" method.