php-crud-api
php-crud-api copied to clipboard
Process add'l data on registration
Added procedure to process additional data sent during registration. Other changes:
- Minor edit to readme to improve readability of the Firebase setup procedure.
- Additional properties for dbAuth for checking max/min length of username as well as allowable characters (thru regex pattern)
NB. Currently, the code throws an error on duplicate entry on columns that are intended to be unique.
Is it ready to merge? Did you accidentally close it?
Is it ready to merge? Did you accidentally close it?
It still causes fatal error on duplicate keys exception so I closed it to review.
Basically, since we are processing additional data, it is possible that the extra data are defined to be unique in the users table. A common example would be an email address. I think we can query the users table if an email address is already registered, but if there 2,3 or more unique fields in the table (not common but possible), we'll also need to query 2,3, or more times.
@mevdschee, Good day! I've added try{}catch around the createSingle invocation when registring new user so I can suppress the PDOException on duplicate key It's not a very elegant solution but that's all I can think of for now.
I hope you can review and improve on it.
Are there any news about it? Can this improvement be merged in the main branch?
My problem is that I use "apiKeyDbAuth mode" so after the user sends username and password to "/register", every following request is blocked because of the "user api_key" is missing (I need to send many fields including "api_key"). This improvement can be useful to bypass the problem. Or are there other solutions for my problem?
πΈ ππππ πππ ππππππππ ππππ ππππ ππππππ ππ'π πππ π’ππ ππππππ ππ ππππ. π°ππ’π ππ’, ππ π’ππ ππ πππ, π’ππ ππππ ππ ππππ ππππ ππ ππππ ππ ππππ π’ππ πππππππ ππππππ π’πππ πππ πππ ππππ πππ ππππππππ ππππ ππππ πππππ πππππ.
π°ππππππ π ππ’ π ππππππ πππππ πππ ππππππππ ππππ ππ ππ πππππ πππ πππππ ππππ πππππππ ππ πππππππ πππππ πππ ππππ ππ π πππππ-ππππ πππππππ;
- ππππππππ ππππ πππ ππππππππ & πππππ πππ,
- πΆππ πππ πππππ ππππ ππππππ ππ ππππ πππ ππππ ππ πππππππ πππππ, ππππππ ππ ππππ πππππ ππ’ πππππππ πππ’.
π°π πππ πππππππ ππππππππ, πΈ ππππππππ ππ'π ππππππ ππ’ πππ πππππππ ππππππ (π‘-πππ-πππ’). πΈ πππππ'π ππππππππππππ’ πππππ πππππ πππ πππ°πππ πππ ππππΊππ’π³ππ°πππ ππππππππ. πΌππ’ππ @mevdschee πππ πππππππ ππ πππππ ππ π πππππππ ππππ πππ ππ ππππ ππ πππ ππππ ππππ.
π°π π π πππππππππ, π’ππ πππ πππππ ππ π ππππππππ ππ πππ πππ.πππ, πππ ππππππππππ π πππ πππ°πππ - ππππ π πππ ππππππ πππππ ππππππππππππ πππ πππ πππππ ππ πππ ππππΊππ’π³ππ°πππ πππ πππ ππ’ π’πππ ππππππππ
πΈ πππππ'π ππππππππππππ’ πππππ πππππ πππ πππ°πππ πππ ππππΊππ’π³ππ°πππ ππππππππ. πΌππ’ππ @mevdschee πππ πππππππ ππ πππππ ππ π πππππππ ππππ πππ ππ ππππ ππ πππ ππππ ππππ.
You may get it to work, as I don't know of a reason it shouldn't work. Feel free to try it and open an issue if you get stuck.
π°ππππππ π ππ’ π ππππππ πππππ πππ ππππππππ ππππ ππ ππ πππππ πππ πππππ ππππ πππππππ ππ πππππππ πππππ πππ ππππ ππ π πππππ-ππππ πππππππ;
If you make the fields nullable and add values to them later in the multi-step process then you don't even need multiple tables.
Are there any news about it? Can this improvement be merged in the main branch?
I'll look into merging this code.
Here's the updated DbAuthMiddleware.
https://github.com/apps-caraga/php-crud-api/commit/c64d99604612867af72e2b7813d99e0348d43a68