Hi, sorry if the question has already been asked, but I cannot find any answer:
First: I created a multi-page questionaire for the workers at a company.
Second: I want to use only one login-data for all users (one user name and password as defined in the Joomla Users section)
Question: Can I prevent the following scenario: Two users fill in the form at the same time, and when the one user is done and logs out, the other user is kicked out?
Any help is appreciated. Thanks!
Carsten
First: I created a multi-page questionaire for the workers at a company.
Second: I want to use only one login-data for all users (one user name and password as defined in the Joomla Users section)
Question: Can I prevent the following scenario: Two users fill in the form at the same time, and when the one user is done and logs out, the other user is kicked out?
Any help is appreciated. Thanks!
Carsten
Hi Carsten,
Not as far as I know - though this is a Joomla! question rather than a CF one.
You could do it perhaps by using an access form to take the username and password (not a Joomla! registration form) then save a token to the ser session and check for a valid token on the form Load.
Bob
Not as far as I know - though this is a Joomla! question rather than a CF one.
You could do it perhaps by using an access form to take the username and password (not a Joomla! registration form) then save a token to the ser session and check for a valid token on the form Load.
Bob
Thanks. You're right, this is a Joomla question … To make it a Chronoforms question: Working with tokens and sessions seems to complicated to me. So: How do I built an access form – and where do I put it within the "setup"-tab – which will give access to the following multi-page questionaire only if you entered the correct data (e.g. a Joomla user login-data)?
Hi Carsten,
I would create a separate form with just the username and password fields. In the On Submit event of the form add an Event Switcher action with one 'fail' event that re-loads the form with an error message.
After the Event Switcher i.e. on 'success' add:
+ a custom code action that adds a 'user_key' string to the $form->data array with code like
+ a Data to Session action to save the value, and add a Session Key to it
+ A ReDirect action or a Load Form action to load the second form
In the second form On Load event add:
+ a Session to Data action with the same Session Key
+ An Event Switcher action with one 'fail' event and with code to check that a user key is set[code]<?php
if ( empty($form->data['user_key') ) {
return 'fail';
}
?>[/code]and, in the on 'fail' event a ReDirect action or a Load Form action to re-load the first form
+ and after the event switcher the normal actions to show the form HTML (render form) etc.
Bob
I would create a separate form with just the username and password fields. In the On Submit event of the form add an Event Switcher action with one 'fail' event that re-loads the form with an error message.
After the Event Switcher i.e. on 'success' add:
+ a custom code action that adds a 'user_key' string to the $form->data array with code like
<?php
// unset these so that they aren't saved to the session
unset($form->data['username']);
unset($form->data['password']);
$form->data['user_key'] = date('Ymdhis');
?>
+ a Data to Session action to save the value, and add a Session Key to it
+ A ReDirect action or a Load Form action to load the second form
In the second form On Load event add:
+ a Session to Data action with the same Session Key
+ An Event Switcher action with one 'fail' event and with code to check that a user key is set[code]<?php
if ( empty($form->data['user_key') ) {
return 'fail';
}
?>[/code]and, in the on 'fail' event a ReDirect action or a Load Form action to re-load the first form
+ and after the event switcher the normal actions to show the form HTML (render form) etc.
Bob
This topic is locked and no more replies can be posted.