Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Can I Use Email as a Token in a Closed-access Survey?

  • msalum1
  • msalum1's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 days 6 hours ago - 6 days 6 hours ago #268779 by msalum1
Please help us help you and fill where relevant:
LimeSurvey version: LimeSurvey Community Edition Version 6.10.0+250106
Own server or LimeSurvey Cloud:  own (organization) 
Survey theme/template: Fruity TwentyThree ( extends_fruity_twentythree )
==================
Hello, 

I’m working on a closed-based survey and was wondering if it’s possible to use email addresses as tokens (access codes). I tried following the steps in a thread ( Using email as token ) posted 6 years ago. I’ve tried directly inputting emails into the token field, but it doesn’t seem to work as well. I’d like participants to enter their email addresses as their access codes when accessing the survey.Here are my questions:
  1. Is it technically possible to use email addresses as tokens in LimeSurvey?
  2. If not, is there a workaround to achieve this? For instance, allowing participants to input their email address as an "access code"?

Thanks again for your time! 

Marlo 
Last edit: 6 days 6 hours ago by msalum1.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 days 6 hours ago #268780 by Joffm
What's the reason to do this?
Do you want to invite people by personal email, saying "Please, enter your email address to access the survey"
 
Here the participant may have several email addresses and doesn't know which one.

Or do you only want to have the email address in the survey to send some results to the participant at the end of the survey?
You may use additional attributes which are accessibenle in a closed survey.

Or what eles do you have in mind?

The thread you referred to is something else. Here the TO asked about a panel integration.

So, please explain.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • msalum1
  • msalum1's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 days 6 hours ago #268781 by msalum1
Thanks for your quick response!

Just briefly... we want to use the participant's email address as the token for entering the survey. So the process is as follows:

1. Participants first complete the questionnaires in Cambian (external survey).

2. They are automatically redirected to Lime after completing the last questionnaire in Cambian

3. The need to enter the email address in Lime as a token (password) for being able to access the survey

I hope this helps!

Do you suggest a better or alternative process? I'm also reading the manual to see if public registration is a better bet.


M.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 days 5 hours ago #268782 by Joffm
Why fo the "need" to use the email address?
Why can't they use any other token?

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • msalum1
  • msalum1's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 days 5 hours ago #268783 by msalum1
I was talking to my team yesterday, and they told me they prefer using email as the token. I suggested using other options, such as last name or first name, since tokens are meant to be alphanumeric. However, they still want to know if it’s possible to use special characters as a token.

I might need to convince them to abandon the use of email as a token if there’s no workaround.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 days 4 hours ago #268784 by Joffm
Yeah, you can.

Edit the function "sanitzeToken" in "application/models/Token.php"
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • msalum1
  • msalum1's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 days 4 hours ago #268785 by msalum1
Oh, great! Thanks!

Which tab or settings should  I got to do this: 

[Edit the function "sanitzeToken" in "application/models/Token.php"

I couldn't find it at Configuration > Themes  or even at Configuration > Dashboard. I'm an admin user but not a superadmin user. 


 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 days 18 hours ago #268787 by Joffm
It's in the source code of Limesurvey.
Bit beeare: Changes here are overwritten by an update.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: msalum1

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 days 12 hours ago #268823 by holch
As Joffm said, this is not a setting in Limesurvey, but you are "hacking" the source code. So this needs to be done by someone who has access to the files on the server and knows what they are doing in terms of coding.

And with any update, this can be overwritten, which is why this should be avoided. Because at the end, what will mostlikely happen? You won't be updating Limesurvey anymore...

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 days 10 hours ago #268831 by DenisChenu
Ask it as feature request : community.limesurvey.org/feature-request/
1 .Allow more characters in token
2. restricted characters for token by config : github.com/LimeSurvey/LimeSurvey/blob/e1...odels/Token.php#L314

I think 2 are an excellent solution !!!
 

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

  • msalum1
  • msalum1's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 days 8 hours ago #268889 by msalum1
Thanks everyone! Yes, I reached out to our superadmin to hack the installation/update the preg_replace pattern to allow email addresses. Here's the code I suggested: 

public static function sanitizeToken($token){// Allow alphanumeric characters, dots, hyphens, underscores, and @return preg_replace('/[^A-Za-z0-9._@-]/', '', $token);}

I also informed them that any updates will overwrite it. I'll send a request to Lime, and hopefully, they can add special characters as tokens in the future.

Cheers! 
Marlo 

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose