Forums

Password Protection without Joomla!-User-Registration

galbur 25 Jun, 2012
Hi

I would like to create a download-form with a Password-Protection.
But without the Joomla!-User-Registration.

1. I send a downloadform-link to somebody with a password.
2. After filling out the form and set the right password in the password-field the user should be redirected to a new page with the download link.

I tried this with the passwordbox but it seems there is no way to predefine the password somewhere.
Any idea?

thank you in advance
chris
GreyHead 25 Jun, 2012
Hi chris,

You can do this with a form that has a password box and a submit button.

Add a Custom Serverside Validation action and use that to check the password - how you do that depends on how your password system works, it could either be from a pre-defined list, or from a list stored in a database table.

Once the password is confirmed you can show the download link using a Thank You page action.

Bob
galbur 26 Jun, 2012
Hi Bob

Thanks for your fast Help!
Unfortunately i am not a php-hero. So there is an empty field in the "custom server side validation"-action. ;-) There is no "Password-System" behind the Scene. I only create a password in my head, let's say: "go4hiking" and then i send this to the user.

Chris
GreyHead 26 Jun, 2012
Hi Chris,

Unfortunately ChronoForms can't read your mind so you have to find some way to let it know what password you've invented. Do you use the same one for all requests or a different one each time?

Bob
galbur 27 Jun, 2012
Hi Bob

Thank you again.
It will be just one password...

Chris
GreyHead 27 Jun, 2012
Hi Chris,

Then you can use the Custom Serverside validation action to check if the password is correct.
<?php
if ( !isset($form->data['pass']) || $form->data['pass'] != 'spaghetti' ) {
  $form->validation_errors['pass'] = "Wrong pasta :-(";.
  return false;
}
?>

Bob
galbur 29 Jun, 2012
Hi Bob,

Thanks a lot for the Code. It doesn't work but maybe i do something wrong?

($form->data['pass']) Is "pass" the fieldname of the Password Box?
Do i have to set something more in the Password-Box than "Label Text", "Field Name" and "required" under validation?

Under "events" i have onlad: "show html" on submit: "Custom Server Side Validation" (with your Code)
and "redirect user". Maybe i forgot something?

Thank you
Chris
GreyHead 29 Jun, 2012
Hi Chris,

Yes 'pass' is the name of the form input.

The only thing I see missing is that you need to drag an Event Loop action into the pink On Fail event of the Custom Serverside action to handle the error.

Bob
galbur 29 Jun, 2012
Hi Bob

Thanks again.
Almost done. But it still doesn't work.

Are the settings ok?


Chris
GreyHead 30 Jun, 2012
Hi Chris,

You can leave the default > On Load setting so that the On Load event is called.

Please see this FAQ

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