- Posts: 185
- Thank you received: 11
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
SOLVED:Conflate word-spaced tokens after entry but before submission
- bulgin
- Topic Author
- Offline
- Elite Member
Less
More
4 years 3 months ago #191860
by bulgin
Conflate word-spaced tokens after entry but before submission was created by bulgin
Hello.
I have a situation where because of various security issues, I need to alter the token after a user enters it into the form so that when Limesurvey checks the participants database table the result passes and grants access to the survey.
I need to convert a password that contains spaces to one without spaces, as limesurvey does not allow spaces in passwords, yet because of the population I'm surveying, we need easy-to-remember passwords, i.e., words separated by spaces.
I'm thinking something in the form submissions should work but am hesitant to change that because of potentially catastrophic results.
Thank you.
I have a situation where because of various security issues, I need to alter the token after a user enters it into the form so that when Limesurvey checks the participants database table the result passes and grants access to the survey.
I need to convert a password that contains spaces to one without spaces, as limesurvey does not allow spaces in passwords, yet because of the population I'm surveying, we need easy-to-remember passwords, i.e., words separated by spaces.
I'm thinking something in the form submissions should work but am hesitant to change that because of potentially catastrophic results.
Thank you.
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
4 years 3 months ago - 4 years 3 months ago #191889
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Conflate word-spaced tokens after entry but before submission
Try placing something like this before the final {% endblock %} tag in /upload/themes/survey/yourThemeName/views/subviews/logincomponents/token.twig:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready',function(){ $('#form-token').on('submit', function(e) { // Remove all white-space from token input $('#token').val($('#token').val().replace(/\s/g,'')); }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 3 months ago by tpartner.
The topic has been locked.
- bulgin
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 185
- Thank you received: 11
4 years 3 months ago #191895
by bulgin
Replied by bulgin on topic Conflate word-spaced tokens after entry but before submission
Thanks Tony, I'll try that.
By the way for anyone viewing this thread - Tony worked on a project I'm developing freelance and did an excellent job! Very professional, on-time and very reasonable price.
If you need a professional LimeSurvey consultant, please consider him.
By the way for anyone viewing this thread - Tony worked on a project I'm developing freelance and did an excellent job! Very professional, on-time and very reasonable price.
If you need a professional LimeSurvey consultant, please consider him.
The following user(s) said Thank You: tpartner
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
4 years 3 months ago - 4 years 3 months ago #191900
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Conflate word-spaced tokens after entry but before submission
Aw shucks, thanks. :blush:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 3 months ago by tpartner.
The topic has been locked.
- bulgin
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 185
- Thank you received: 11
4 years 3 months ago #191906
by bulgin
Replied by bulgin on topic Conflate word-spaced tokens after entry but before submission
Having difficulty finding that twig file. At:
/var/www/html/limesurvey/upload/themes/survey
I only see:
extends_bootswatch extends_bootswatch_checkbox extends_SklVanilla extends_vanilla_for_voices generalfiles index.html SklVanilla
but under "General Settings" my template is listed as "Vanilla" - not SklVanilla, Extends or otherwise. . .
/var/www/html/limesurvey/upload/themes/survey
I only see:
extends_bootswatch extends_bootswatch_checkbox extends_SklVanilla extends_vanilla_for_voices generalfiles index.html SklVanilla
but under "General Settings" my template is listed as "Vanilla" - not SklVanilla, Extends or otherwise. . .
The topic has been locked.
- bulgin
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 185
- Thank you received: 11
4 years 3 months ago #191913
by bulgin
Replied by bulgin on topic SOLVED:Conflate word-spaced tokens after entry but before submission
It was located in:
/var/www/html/limesurvey/themes/survey/vanilla/views/subviews/logincomponents/token.twig
not
/upload/themes/survey/yourThemeName/views/subviews/logincomponents/token.twig:
and more importantly the script you suggested works perfectly!
Thanks again!
/var/www/html/limesurvey/themes/survey/vanilla/views/subviews/logincomponents/token.twig
not
/upload/themes/survey/yourThemeName/views/subviews/logincomponents/token.twig:
and more importantly the script you suggested works perfectly!
Thanks again!
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
4 years 3 months ago - 4 years 3 months ago #191914
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic SOLVED:Conflate word-spaced tokens after entry but before submission
I don't recommend modifying the core themes - they will be over-written on updating.
Extend a core theme as described here - manual.limesurvey.org/New_Template_System_in_LS3.x and then modify the file in the extended theme.
Extend a core theme as described here - manual.limesurvey.org/New_Template_System_in_LS3.x and then modify the file in the extended theme.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 3 months ago by tpartner.
The topic has been locked.
- bulgin
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 185
- Thank you received: 11
4 years 3 months ago - 4 years 3 months ago #191925
by bulgin
Replied by bulgin on topic SOLVED:Conflate word-spaced tokens after entry but before submission
Okay, thanks for the tip. I've extended and am now using that one but the /var/www/html/limesurvey/upload/themes/survey/extends_vanilla/views/subviews/logincomponents/ directory is empty. Am I supposed to also copy over that core directory files when extending?
Last edit: 4 years 3 months ago by bulgin.
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
4 years 3 months ago #191943
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic SOLVED:Conflate word-spaced tokens after entry but before submission
Yes, you will need to copy the token.twig file from the vanilla theme.
You can either copy it via FTP into /upload/themes/survey/extends_vanilla/views/subviews/logincomponents/ or you can use the theme editor to create a copy.
You can either copy it via FTP into /upload/themes/survey/extends_vanilla/views/subviews/logincomponents/ or you can use the theme editor to create a copy.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.