Bug #52904
closedNamespace problem in JS when extending TCA evalfields
100%
Description
I extend the TCA evaluators for the be_users passwords with my extension and rewritten it with namespaces.
In the TCA field I have to set the complete namespace to get it work in PHP, but in JS it's broken now.
TCA:
$TCA['be_users']['columns']['password']['config']['eval'] = 'trim,required,SpoonerWeb\\BeSecurePw\\Evaluation\\PasswordEvaluator,tx_saltedpasswords_eval_be,password';
Result in JS (jsfunc.tbe_editor.js) when debugging "evallist" in line 640:
'trim,required,SpoonerWebBeSecurePwEvaluationPasswordEvaluator,tx_saltedpasswords_eval_be,password'
It breaks the complete JS functionality and no fields are filled with data from the database.
Either we have to change the integration for the eval fields or JS has to know how to handle the namespace in this case.
To reproduce it you can install the extension be_secure_pw (master) on:
Updated by Stefan Aebischer about 11 years ago
The namespaced eval function generates an invalid javascript function name "function SpoonerWeb\BeSecurePw\Evaluation\PasswordEvaluator(newValue)". In chrome this breaks all the TBE_EDITOR definitions and with that all the functionality in jsfunc.tbe_editor.js.
This diff was a quick try to solve the bug. Unfortunately it is not well tested and i have no idea what regressions it could introduce. Therefore it is not ready for a gerrit PR. I posted it anyway because it could lead the guys with a deeper understanding of the TYPO3 BE form internals, where to get their hands dirty.
https://gist.github.com/pAlpha627/7092156
Indeed it would be nice, to have a possibility to use namespaced "eval" functions. At least there should be some syntax checks for the generated Javascript in TYPO3\CMS\Backend\Form\FormEngine, in oder to avoid breaking the whole functionality.
BTW: As of now the master branch of be_secure_pw contained only "PasswordEvaluator" and not "SpoonerWeb\\BeSecurePw\\Evaluation\\PasswordEvaluator" as mentioned in the Bug report. In order to reproduce the bug you have to change the $TCA['be_users']['columns']['password']['config']['eval'] in be_secure_pw/ext_tables.php.
Updated by Thomas Löffler about 11 years ago
Thanks for the patch. I will have a look on it.
Yes, I thought I pushed the last commit, but I've seen that I forgot to do it. :)
Updated by Thomas Löffler about 11 years ago
Hi Stefan,
this patch works for me and is not breaking any functionality of other evaluators.
I would suggest to push it to Gerrit. The reviewing people will have corrections for the code, if there are any. :)
Will you push it or should I?
Thomas
Updated by Gerrit Code Review about 11 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/25041
Updated by Stefan Aebischer about 11 years ago
Will you push it or should I?
Hi Thomas fine for me if you push it
Stefan
Updated by Gerrit Code Review about 11 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/25041
Updated by Gerrit Code Review about 11 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/25041
Updated by Gerrit Code Review about 11 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/25041
Updated by Gerrit Code Review about 11 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25041
Updated by Gerrit Code Review about 11 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25041
Updated by Thomas Löffler about 11 years ago
- Download extension "be_secure_pw" (master branch) from https://github.com/spoonerWeb/be_secure_pw
- Install it
- Try to edit a be_user record
Updated by Gerrit Code Review about 11 years ago
Patch set 1 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25317
Updated by Gerrit Code Review about 11 years ago
Patch set 1 for branch TYPO3_6-0 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25318
Updated by Anonymous about 11 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset f1137735693dd70d073b323d3af7e85499ebda2b.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed