- Posts: 88
- Thank you received: 7
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
token creation algorithm
- tassoman
- Topic Author
- Offline
- Premium Member
Less
More
3 years 5 months ago #206720
by tassoman
«All your survey answers are belong to us »
token creation algorithm was created 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...
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.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
3 years 5 months ago - 3 years 5 months ago #206723
by DenisChenu
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.
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
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: 3 years 5 months ago by DenisChenu. Reason: Not in 3.X
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
3 years 5 months ago #206726
by DenisChenu
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.
Replied by DenisChenu on topic token creation algorithm
Manual page :
manual.limesurvey.org/AfterGenerateToken
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
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 88
- Thank you received: 7
3 years 5 months ago #206733
by tassoman
«All your survey answers are belong to us »
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'); ?
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.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
3 years 5 months ago - 3 years 5 months ago #206734
by DenisChenu
Are you sure ?
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.
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" *
Maybe an issue with inherited or something like that ?tassoman wrote: Last question is: because my token doesn't have a fixed length, should I keep NULL $event->get('iTokenLength'); ?
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: 3 years 5 months ago by DenisChenu.
The topic has been locked.
- tassoman
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 88
- Thank you received: 7
3 years 5 months ago #206739
by tassoman
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 »
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.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
3 years 5 months ago - 3 years 5 months ago #206744
by DenisChenu
The current alternative i use to replace core system it's beforeControllerAction : then i con do what i want but need to construct the whole controller
Sample : framagit.org/SondagePro-LimeSurvey-plugi...dminStatitistics.php (old one , unsure its still work …)
PS : maybe you can ask to move this event in next 3.X version ? Seems new feature is accepted again in 3.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.
Replied by DenisChenu on topic token creation algorithm
I don't find how … maybe … but really didn't know …tassoman wrote:
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?
The current alternative i use to replace core system it's beforeControllerAction : then i con do what i want but need to construct the whole controller
Sample : framagit.org/SondagePro-LimeSurvey-plugi...dminStatitistics.php (old one , unsure its still work …)
PS : maybe you can ask to move this event in next 3.X version ? Seems new feature is accepted again in 3.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: 3 years 5 months ago by DenisChenu. Reason: PS
The following user(s) said Thank You: tassoman
The topic has been locked.
- tassoman
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 88
- Thank you received: 7
3 years 5 months ago - 3 years 5 months ago #206746
by tassoman
«All your survey answers are belong to us »
Replied by tassoman on topic token creation algorithm
I wrote a note in the issue tracker to link the feature request to this topic.
I dunno if can be wise to accept new features inside 3.x branch. In my opinion you'll end up having community never upgrading to 4.x branch.
I feel I can write two extending classes inside my plugin php file.
In the worst case I'm going to have an error of class not initialized.
PS: in Matomo project they accept backports on 3.x branch by pull request merge. It means you can checkout 4.x, copy the code you need, create a new branch 3.x-myfeat then ask to merge this branch to that 3.x-dev.
It's a smart decision, I've already did in the past. They only accept backports merged by community.
I dunno if can be wise to accept new features inside 3.x branch. In my opinion you'll end up having community never upgrading to 4.x branch.
I feel I can write two extending classes inside my plugin php file.
In the worst case I'm going to have an error of class not initialized.
PS: in Matomo project they accept backports on 3.x branch by pull request merge. It means you can checkout 4.x, copy the code you need, create a new branch 3.x-myfeat then ask to merge this branch to that 3.x-dev.
It's a smart decision, I've already did in the past. They only accept backports merged by community.
«All your survey answers are belong to us »
Last edit: 3 years 5 months ago by tassoman. Reason: note on backporting
The following user(s) said Thank You: DenisChenu
The topic has been locked.