Capturing Password field in SQL Actions

13 years 4 weeks ago - 13 years 3 weeks ago #155737 by WebJIVE
Hi, we just started testing the SQL action for the last leg of a build we're doing for a client (CBSubs rocks btw!).

When we built our SQL action, we used the DOC and other helpful tip from the forums but, after enabling debug, it looks like we might have a problem with our SQL. One of the things we're doing is using an external MySQL table to authenticate Joomla with for logging in so therefore, we need to insert the password (clear text) into that DB.

When I constructed the SQL, I thought it might work but, we're getting an error with the password field from CB.

500 - JDatabaseMySQL::query: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[password], , , eric@web-jive.com, 501-588-1979)' at line 9 SQL=INSERT INTO users ( users.user_id, users.username, users.password, users.firstname, users.lastname, users.email, users.phone ) VALUES (1012, webjive, [password], , , eric@web-jive.com, 501-588-1979);


Here's the SQL we use..
INSERT INTO users ( users.user_id, users.username, users.password, users.firstname, users.lastname, users.email, users.phone )

VALUES ([user_id], [username], [password], [firstname], [lastname], [email], [cb_homephone]);

Any thoughts?

Eric Caldwell
Web-JIVE.com

Please Log in to join the conversation.

13 years 3 weeks ago #155801 by krileon
Replied by krileon on topic Re: Capturing Password field in SQL Actions
Strings must be surrounded with single quotes. Please try the below.
INSERT INTO `users` ( `user_id`, `username`, `password`, `firstname`, `lastname`, `email`, `phone` ) VALUES ( [user_id], '[username]', '[password]', '[firstname]', '[lastname]', '[email]', '[cb_homephone]' );

Please note this may not give you plaintext password. The only way for plaintext password is to obtain it after registration, after login, or after profile update (if password changed). Using CBSubs to obtain it is not the best approach is CBSubs has its own "order of operation".

Best way to synchronize users is with professional subscriber incubator project CB Queries, which allows execution of queries at various CB triggers such as after registration and has code in place to prepare plaintext password (when possible of course).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

13 years 3 weeks ago #155804 by WebJIVE
Replied by WebJIVE on topic Re: Capturing Password field in SQL Actions
Question then. Can I prefill the current password field with a default value in the fields manager, hide the default password field and use a text box to capture a cb_password field?

If I can do this, then my external auth plugin will still work since the default Joomla password isn't being used anyway..

Eric Caldwell
Web-JIVE.com

Please Log in to join the conversation.

13 years 3 weeks ago #155809 by WebJIVE
Replied by WebJIVE on topic Re: Capturing Password field in SQL Actions
OK, my suggestion above worked but, now the firstname and lastname are not being populated in the SQL query from CBSubs.

What would cause that?

Thx.

Eric Caldwell
Web-JIVE.com

Please Log in to join the conversation.

13 years 3 weeks ago #155810 by krileon
Replied by krileon on topic Re: Capturing Password field in SQL Actions
The substitution of [firstname] and [lastname] is correct. Neither will provide anything if you have not configured name display to use at least First and Last Name fields. This can be configured within CB Configuration on the General tab as the parameter Name Style.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.355 seconds

Facebook Twitter LinkedIn