View Issue Details

This bug affects 1 person(s).
 14
IDProjectCategoryView StatusLast Update
16042Bug reportsRemoteControlpublic2020-11-23 14:57
Reporterjayce Assigned Togabrieljenik  
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
Product Version4.1.0 
Summary16042: Generated token length is too short with add_participants()
Description

Hello,
When i use the function add_participants() with the RemoteControle2 API the generated token is too short (3 caracters).
The token has the good length when the token length is set in the survey settings but is not good when the settings is inherited from global settings.

TagsNo tags attached.
Bug heat14
Complete LimeSurvey version number (& build)Version 4.1.0+200128
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMariaDB 10.4.11
Server OS (if known)
Webserver software & version (if known)
PHP Version 7.2.26

Users monitoring this issue

There are no users monitoring this issue.

Activities

ollehar

ollehar

2020-03-27 11:31

administrator   ~56806

Please update to the latest version and try again. Thank you.

jayce

jayce

2020-03-27 16:11

reporter   ~56813

Same problem with the latest Version 4.1.13+200325

DenisChenu

DenisChenu

2020-05-26 16:32

developer   ~58048

@jayce : inherited for group are not 3 ? Right or not ?

sverker84

sverker84

2020-07-26 00:31

reporter   ~59088

Same problem with Version 4.3.5+200721
When setting is "Inherit: On", the length is shown as 15 in the textbox field (which is disabled).
In the Global Survey Settings, it is also set to 15.

The problem seems to be in "models/Token.php" in the generateToken function.

public function generateToken($tokenlength = NULL)
{
$iTokenLength = $tokenlength ? $tokenlength : $this->survey->tokenlength;

And in the generateTokens function (which works fine, even when Inherit is on), it has this code:

    $iTokenLength = isset($this->survey) && is_numeric($this->survey->oOptions->tokenlength) ? $this->survey->oOptions->tokenlength : 15;

If I change the code for setting $iTokenLength in generateToken to match the code in generateTokens, the JSON RPC-call works fine.

cdorin

cdorin

2020-11-10 20:24

reporter   ~60607

@gabrieljenik, could you please take a look at this one?

gabrieljenik

gabrieljenik

2020-11-13 14:01

manager   ~60634

Last edited: 2020-11-13 14:03

PR: https://github.com/LimeSurvey/LimeSurvey/pull/1654
RC token generation should be tested as well as regular token generation (admin side), due to the code reorg

gabrieljenik

gabrieljenik

2020-11-23 10:23

manager   ~60735

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=30740

lime_release_bot

lime_release_bot

2020-11-23 14:57

administrator   ~60742

Fixed in Release 4.3.28+201123

Related Changesets

LimeSurvey: master 4341214e

2020-11-23 10:23:03

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 16042 generated token length is too short with add participants() (#1654)

* Fixed issue 16042: Generated token length is too short with add_participants()

Updated code from generateTokens()

* Fixed issue 16042: Generated token length is too short with add_participants()

Code reorg

* Fixed issue 16042: Generated token length is too short with add_participants()

Code reorg

* Fixed issue 16042: Generated token length is too short with add_participants()

Dummy change to trigger travis
Affected Issues
16042
mod - application/models/Token.php Diff File
mod - tests/README.md Diff File

Issue History

Date Modified Username Field Change
2020-03-25 15:49 jayce New Issue
2020-03-27 11:31 ollehar Note Added: 56806
2020-03-27 11:31 ollehar Status new => feedback
2020-03-27 16:11 jayce Note Added: 56813
2020-03-27 16:11 jayce Status feedback => new
2020-05-26 16:32 DenisChenu Note Added: 58048
2020-07-26 00:31 sverker84 Note Added: 59088
2020-11-10 20:24 cdorin Note Added: 60607
2020-11-10 20:24 cdorin Status new => feedback
2020-11-13 14:01 gabrieljenik Note Added: 60634
2020-11-13 14:03 gabrieljenik Note Edited: 60634
2020-11-23 10:23 gabrieljenik Changeset attached => LimeSurvey master 4341214e
2020-11-23 10:23 gabrieljenik Note Added: 60735
2020-11-23 10:23 gabrieljenik Assigned To => gabrieljenik
2020-11-23 10:23 gabrieljenik Resolution open => fixed
2020-11-23 14:57 lime_release_bot Note Added: 60742
2020-11-23 14:57 lime_release_bot Status feedback => closed