idh63
Posts: 76
|
| Posted: 09/19/2008, 9:19 AM |
|
I wanted to add this tip to the forum for others so that:
1. Instead of always posting a question and not helping others, I have finally been able to post something of value.
2. Save Yessoftware support from going though the same thing with someone else.
This tip pertains to modifying the DataSource on a form. A signup form is a good example.
You want to encrypt the password field and in CCS4.x there is a new way to get this done, CCEncryptPasswordDB($value).
In the following, the password text box name is 'pword'.
If your form insert is automatic, in other words, You have not created a custom insert, then following the instructions found in the manual for using CCS's "Add Action | Encrypt Password" on BeforeBuildInsert will work fine.
The resulting CCS generated code is: $Component->DataSource->pword->SetValue(CCEncryptPasswordDB($Component->DataSource->pword->GetValue()))
I usually have to use Custom Insert on my signup forms and I have found that the instructions in the manual do not hold true. So I always had to encrypt the password in the form field using Before Insert and the following : $formname->pword->SetValue(CCEncryptPasswordDB($formname->pword->GetValue()))
This works but if there is an insert error and the user is returned to the signup form, the password field is now populated with the encrypted password.
So for Custom Insert, here is the solution as provided by Yessoftware support:$Container->DataSource->cp["pword"]->SetValue(CCEncryptPasswordDB($Container->DataSource->cp["pword"]->GetValue()));
I know this may be obvious to seasoned CCS users with advanced php programming skills.
I have seen other members posts in the past about problems altering the DataSource and I had a "me too" moment, so I hope this tip proves helpful.
|