in2code-de / powermail

This is the official repository of the TYPO3 extension powermail! Powermail is a well-known, editor-friendly, powerful and easy mailform extension for TYPO3
https://in2code.de
88 stars 174 forks source link

validation by regex works client side (JS), but not server side #528

Closed derBoogie closed 3 months ago

derBoogie commented 4 years ago

Hi, I have an problem with the validation of a password field with the following regex: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W])[a-zA-Z0-9\S]{8,}$/ -> rule: min. 8 characters, a small and a capital character, a number, a special character It works client side (JS) but not serverside. (TYPO3 9.5, Powermail 7.4.0)

Can someone test and confirm that?

Thanks!

mtness commented 4 years ago

Yes, I can confirm that regex pattern validation does not seem to work, when ther is a unicode range included, like: ^[A-Za-z\-\_\,\.\s\u00c0-\u1f0f]+$ without that, it seems to work^^

Hawkeye1909 commented 3 years ago

I can confirm at least the problem with unicode ranges. The cause is that regular expressions for JavaScript and PHP/ PCRE are not completely compatible. So either a converter (not sure if that's even possible for all cases but here's something I've found: https://github.com/TooTallNate/pcre-to-regexp) would be needed or the possibility to enter an optional server regex (which would be a lot easier to implement...).

Edit: I helped myself by not using the unicode positions but the characters themselves. So \u00C0-\u017F became À-ſ, which works for JavaScript and PCRE.

mschwemer commented 3 months ago

Cannot confirm this issue any more. Please not that the / are not allowed in the regex field.

Tested with the latest powermail release and php 8.1