Welcome to the LimeSurvey Community Forum

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

token creation algorithm

  • tassoman
  • tassoman's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • net addicted geek administering LS
More
2 years 5 months ago #206720 by tassoman
Hello there,
is it possible to write a plugin hooking to token creation event?

I would like to avoid random string generation and substitute it with random word token creation.
Alphanumeric token it's really difficult to remember.

So my ideal token would be a selection of random dictionary words and a numeric code. For example: dog-apple-434, cat-pear-221, rat-melon-364, horse-orange-996 etc etc...

«All your survey answers are belong to us »
The topic has been locked.
More
2 years 5 months ago - 2 years 5 months ago #206723 by DenisChenu
Replied by DenisChenu on topic token creation algorithm
In 4.X you have an event (i must check if it was in manual)

And a sample core plugin
github.com/LimeSurvey/LimeSurvey/tree/ma.../plugins/customToken

[strike]Not in 4.X[/strike] Not in 3.X

See bugs.limesurvey.org/view.php?id=15026

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 2 years 5 months ago by DenisChenu. Reason: Not in 3.X
The topic has been locked.
More
2 years 5 months ago #206726 by DenisChenu
Replied by DenisChenu on topic token creation algorithm

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • tassoman
  • tassoman's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • net addicted geek administering LS
More
2 years 5 months ago #206733 by tassoman
Replied by tassoman on topic token creation algorithm
Thank you Denis for your complete reply.
I can understand branch 3.x development is now frozen for features. Just security patches.
So the team accepts new features only on 4.x branch.

This feature is available in LS since 3.17.x the only effort is to write a plugin who define the token creation behaviour. In detail I must hook to afterGenerateToken event

github.com/LimeSurvey/LimeSurvey/pull/13...f9ab2fb344877c925R13

Last question is: because my token doesn't have a fixed length, should I keep NULL $event->get('iTokenLength'); ?

«All your survey answers are belong to us »
The topic has been locked.
More
2 years 5 months ago - 2 years 5 months ago #206734 by DenisChenu
Replied by DenisChenu on topic token creation algorithm

tassoman wrote: This feature is available in LS since 3.17.x the only effort is to write a plugin who define the token creation behaviour. In detail I must hook to afterGenerateToken event


Are you sure ?
Code:
[shnoulle@poledra 3LTS]$ cd application/
[shnoulle@poledra application]$ grep -r "afterGenerateToken" *

tassoman wrote: Last question is: because my token doesn't have a fixed length, should I keep NULL $event->get('iTokenLength'); ?

Maybe an issue with inherited or something like that ?
4.X ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 2 years 5 months ago by DenisChenu.
The topic has been locked.
  • tassoman
  • tassoman's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • net addicted geek administering LS
More
2 years 5 months ago #206739 by tassoman
Replied by tassoman on topic token creation algorithm

DenisChenu wrote: Are you sure ?


Well ... No I've did a mistake. The hook was added only inside the 4.x branch.

Do you think I have a chance to extend the method named generateToken inside the Token model by writing a plugin?

«All your survey answers are belong to us »
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose