download with password

mac2 24 Jul, 2013
Hello,
i have two download files, and each of them must be freed with a private password for download.

is this task with chronoforms /Security Question or a other Tools possible?

Best regards
Maggie
GreyHead 24 Jul, 2013
Hi Maggie,

I'd probably do this with a very simple form. Add a password entry box and submit button and then use a Custom ServerSide Validation action to check the password; show the file download links in a 'Thank You page' action.

Bob
mac2 24 Jul, 2013
Thanks Bob,
i will try your way.

maggie
mac2 24 Jul, 2013
:oops: Sorry,
where can i find the action: ServerSied Validation?

Maggie
mac2 24 Jul, 2013
What i did:

Password Box
Submit button

Events:
On Submit
Custom Server Side Validation

<?php
$ok_values = array(
  'passwort'
);
if ( !in_array($form->data['data'], $ok_values ) {
  $form->validation_errors['data'] = "Error";
  return false;
}
?>

On Succes
Show Thanks Message (with the Download-File)

On Fail
Event Loop
Target event
> On Submit > Custom ServerSide Validation (0) > OnFail
Quit next actions
No

...No Form is shown on my page 😟
Maggie
mac2 24 Jul, 2013
okay,
onload i forgot = show html
and no i can see the password-field an the submit button :-)
but then goes error :-(

Thanks for help
Maggie
GreyHead 25 Jul, 2013
Hi Margaret,

Please set the Event Loop to loop to the > On Load event (that is the default setting) as you want to re-load the form when there is an error.

Is 'data' the name of your password input?

Bob
mac2 25 Jul, 2013
Hi Bob,
thanks, i changed by 'loop event' >onload.
Yes, i want to test with 'data'.

Maggie
GreyHead 25 Jul, 2013
Hi Maggie,

And is it working now?

If not, please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.

Note: if you are using the Easy Wizard you can turn on Debug on the Others tab.

Bob
mac2 25 Jul, 2013
...the result:

Data Array:

Array
(
[chronoform] => haccp_update
[event] => submit
[Itemid] => 203
[option] => com_chronoforms
[view] => form
[Benutzerpasswort] => data
[input_submit_1] => Submit
[720a49f5c8e899f31540f1670772957e] => 1
)

Validation Errors:

Array
(
)
GreyHead 25 Jul, 2013
Hi Maggie,

It looks as though the password input is called 'Benutzerpasswort' and not 'data'??

Bob
mac2 25 Jul, 2013
Hi Bob,
'Benutzerpasswort' is called the Label from the password input field.

Maggie
GreyHead 26 Jul, 2013
Hi Maggie,

It may be the Label but the debugger output tells me that it is the name too. There is no visible output with the name 'data'.

Bob
mac2 26 Jul, 2013
Hm, where must you enter the password?
GreyHead 26 Jul, 2013
Hi Maggie,

I'm sorry I don't understand your question :-(

Bob
mac2 26 Jul, 2013
:oops: I don't no, in which script I must register (in the backend of chronoForms) the password.
Maggie
GreyHead 26 Jul, 2013
Hi Maggie,

I still don't understand your question - earlier in the thread I think that we talked about using a custom Serverside Validation action to check the password.

Bob
mac2 26 Jul, 2013
Hi Bob,
yes, I want to give a password i shall name it now "password".
This 'password' must be, deposited in the script so that the user can type in the box ' type the credentials ', this password and than follows the download file sharing.

I hope, you can follow me.
Maggie
GreyHead 26 Jul, 2013
Hi Maggie,

Yes that's what we've talked about all through this thread. Which part isn't working???

Bob
mac2 27 Jul, 2013
Hi Bob,
all is wrong 😟

/administrator/components/com_chronoforms/form_actions/custom_serverside_validation/custom_serverside_validation.php(16) : eval()'d code on line 5

serverside_validation is:
<?php
$ok_values = array(
  'passwort'
);
if ( !in_array($form->data['data'], $ok_values ) {
  $form->validation_errors['data'] = "Falscheingabe";
  return false;
}
?>
GreyHead 27 Jul, 2013
Hi Maggie,

This line is missing a ) It should be:
if ( !in_array($form->data['data'], $ok_values) ) {


Bob
mac2 27 Jul, 2013
Thanks Bob,
but by input the password 'passwort' the error display 'Falscheingabe' is shown.

Maggie
GreyHead 27 Jul, 2013
HI Maggie,

As I said a while ago:

It looks as though the password input is called 'Benutzerpasswort' and not 'data'??



Have you tried this??
if ( !in_array($form->data['Benutzerpasswort'], $ok_values) ) {


Bob
mac2 27 Jul, 2013
Hi Bob,
😶 I hope you will help me again, please.
This are my settings:
Preview:
Password Box 
Field Name = Hirsebrei
Field ID= hirsebrei
Field Max Length= 150
Field Size= 30
Label Text= Benutzerpasswort eintragen

Submit Butten
Name= input_submit_1
Text= Submit
Button Type= Submit

Events:
On Load
Show html
Republish form data= Yes (recommended)
Display Fields Errors= Yes (recommended)
Load Security Token= Yes (recommended)
Load Keep Alive= No
Curly brackets replacer= No
Submission Event= submit
Page Number= 1

On Submit
	Custom Server Side Validation

<?php
$ok_values = array(
  'eingabe'
);
if ( !in_array($form->data['hirsebrei'], $ok_values )) {
  $form->validation_errors['hirsebrei'] = "Falscheingabe";
  return false;
}

	OnSuccess
		Show Thanks Message
	OnFail
		Event Loop
Target Event= >On Load
Quit next actions= No


Thanks a lot for your patience and help
Maggie
GreyHead 27 Jul, 2013
Hi Maggie,

The name is now Hirsebrei but in the Custom code you have used hirsebrei. They must be identical.

Bob
mac2 27 Jul, 2013
Hi Bob,
'hirsebrei' is now everywhere in littel letters, but the result is: [attachment=0]passwortabfrage.png[/attachment]

Maggie
GreyHead 27 Jul, 2013
Hi Maggie,

By all means email or PM me the site URL and a SuperAdmin login and I'll take a quick look.

Bob
mac2 28 Jul, 2013
:cry: There is no URL.
Maggie
GreyHead 28 Jul, 2013
Hi Maggie,

Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

Bob
This topic is locked and no more replies can be posted.