TOF,
that is correct, more or less.
Usually you find a function or command for anything you like to do in
BoltWire.
If not you can define a function or command by yourself.
You put this code in the config.php file.
In our case we need a command to encrypt the content of a text field in a
form.
BoltWire does not provide this command out of the box.
That is why Dan provided you with the code the enhance the functionality.
You put that code (it is always php code) in that config.php file and -
voilĂ - you can use that command in all your forms.
Your config.php is like a big box where you can add php code to enhance
BoltWire to your needs.
So this is what we have done here: providing a command that encrypts the
content of a form field.
I am no programmer, I have always a learning curve when I try something
new, but I have a couple of sites running successfully.
If I want something that BoltWire does not provide I look into the source
code and copy/paste my own functions and commands and put them into the
config.php. That is what Dan means - this way is easier than creating a
plugin (You can enhance functionality too by using javascript or js
frameworks. Then you work with [(embed)].)
So there is a learning curve but from my point of view this learning curve
is smaller than with other frameworks.
By the way I found the typo by testing the form line by line and write out
the results on test page.
[form]
[t]
[r][c top]Current Password [c][password passnow]
[r][c]New Password [c][password password]
[r][c]Again [c][password password2]
[t]
[submit]
[command encrypt {=passnow}]
[command savedata passnow,password,encrypt]
[form]
Checking my test page with action=data I could see that crypt does not
work.
This is a basic but good way to check if your form works.
A form that handles both cases of passwords needs to check if either the
encrypted password or the clear password will match.
Maybe like this (did not test that):
[command if_1 "! equal {~password} {=encrypt_1} || ! equal {~password}
{=passnow} ? warn='Try again!'"]
Why do you want to form that checks passwords that are not encrypted?
Keep going, ask here, glad to help.
Greetings, Martin
Am Donnerstag, 26. Juni 2014 19:19:45 UTC+2 schrieb TheOldFellow:
>
> Martin,
>
> I am really grateful for this.
>
> To summarise (making sure I understand this)
>
> With encrypted passwords we need two files:
>
> config/config.php and pages/action.password
>
> config.php is:
> <?php if (!defined('BOLTWIRE')) exit();
>
> function BOLTXencrypt($value, $field) {
> global $cryptkey;
> return crypt($value, $cryptkey);
> }
>
> if ($pageLink == 'action=password') {
> function BOLTXencrypt($value, $field) {
> global $cryptkey;
> return crypt($value, $cryptkey);
> }
> }
>
> action.password is:
>
> !Change Password
>
> [form]
> [t]
> [r][c top]Current Password [c][password passnow]
> [r][c]New Password [c][password password]
> [r][c]Again [c][password password2]
> [t]
> [submit]
> [command encrypt_1 {=passnow}]
> [command if_1 "! equal {~password} {=encrypt_1} ? warn='Current password
> {~password}={=encrypt_1} is not correct. Try again!'"]
>
> [command if_2 "! equal {=password} {=password2} ? warn='New passwords do
> not match. Try again!'"]
> [command warn]
> [command encrypt_2 {=password}]
>
> [command reset password={=encrypt_2}]
>
> [command savedata password page=member.{id}]
> [form]
>
> And that's it. To call it add, for instance,
>
> [[{p}&action=password|change password]]
>
> to the {actions} in code.settings.
>
> For Unencrypted passwords, there is no need for the config.php file, and
> the action.password file should read:
>
> !Change Password
>
>
> [form]
> [t]
> [r][c top]Current Password [c][password passnow]
> [r][c]New Password [c][password password]
> [r][c]Again [c][password password2]
> [t]
> [submit]
> [command if_1 "! equal {~password} {=passnow} ? warn='Current password
> {~password}={=passnow} is not correct. Try again!'"]
> [command if_2 "! equal {=password} {=password2} ? warn='New passwords do
> not match. Try again!'"]
> [command warn]
> [command reset password={=password}]
> [command savedata password page=member.{id}]
> [form]
>
> But I'm sure it's possible to write a function that handles both cases.
>
> TOF.
>
>
> On Thursday, 26 June 2014 16:57:06 UTC+1, mz wrote:
>>
>> ha, missed one "crypt" ...
>>
>>
>>> !Change Password
>>>
>>>
>>> [form]
>>> [t]
>>> [r][c top]Current Password [c][password passnow]
>>> [r][c]New Password [c][password password]
>>> [r][c]Again [c][password password2]
>>> [t]
>>> [submit]
>>> [command encrypt_1 {=passnow}]
>>> [command if_1 "! equal {~password} {=encrypt_1} ? warn='Current password
>>> {~password}={=encrypt_1} is not correct. Try again!'"]
>>>
>>> [command if_2 "! equal {=password} {=password2} ? warn='New passwords do
>>> not match. Try again!'"]
>>> [command warn]
>>> [command encrypt_2 {=password}]
>>> [command reset password={=encrypt_2}]
>>>
>>> [command savedata password page=member.{id}]
>>> [form]
>>>
>>>
>>>> Greetings, Martin
>>>>
>>>>
>>>>>>
--
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/boltwire.
For more options, visit https://groups.google.com/d/optout.