Adding a password to prevent bots

Having suffered from bots completing my questionnaire and using up credits, I’d like to request a password from the participant and stop the experiment if incorrect. If I add a field in the Experiment info (under “participant” and “session”) called “enter password”, how do I retrieve that in a later IF function?

If you call the field ‘enter password’ you will find it in

expInfo['enter password']

I’m passing a code called researcher from Qualtrics (which has the PI sheet) and force quit back to the Qualtrics survey if the researcher value is incorrect. I also recently used it to test a live experiment by drastically cutting the number of trials if my own staff number was entered as the researcher code.

How are you doing that wakecarter?

I’ve got the following in code_JS End Routine. I also have similar code in Begin Routine to change the text of the first routine to “Please read the Participant Information Sheet first”

 if ((expInfo["researcher"] !== "xxxxxx")} {
 psychoJS.quit({message: 'Please click to go to the participant information sheet'});
 }

Thank you. To try and filter out fake participants (I got hit with 60 yesterday) I am asking them to contact me directly for a password. Both Qualtrics and Pavlovia require that password now.

Is there still the difficulty with psychoJS.quit() that Pavlovia credits will be used up because the script finishes as planned but you have no data?

My work around is to have an opening routine with a text component of unlimited duration saying “Incorrect, press Esc and close tab”, and in the Every Frame tab of a code component:

if expInfo['Enter secret code:'] == "xxxxxxxx":
    continueRoutine = False

As an additional question, is it possible for the participant to view the source code, and therefore the password?

You need to have saving incomplete data turned off.

What’s the link to run your experiment? I’ll see if I can find the password via the console.

You need to have saving incomplete data turned off.

Ah, I didn’t read that detail, thank you! I’ll email you the link rather than making it public.