File tree 4 files changed +20
-3
lines changed
4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,17 @@ public function validateField()
203
203
}
204
204
break ;
205
205
206
+ case stristr ($ validationSetting , 'captcha( ' ):
207
+ $ wordRepository = ObjectUtility::getObjectManager ()->get (\SJBR \SrFreecap \Domain \Repository \WordRepository::class);
208
+ $ wordObject = $ wordRepository ->getWord ();
209
+ $ wordHash = $ wordObject ->getWordHash ();
210
+ $ userVal = md5 (strtolower (utf8_decode ($ this ->getValue ())));
211
+ if ($ wordHash !== $ userVal ) {
212
+ $ this ->addMessage ('validationErrorCaptcha ' , 'captcha ' );
213
+ $ this ->isValid = false ;
214
+ }
215
+ break ;
216
+
206
217
default :
207
218
// e.g. search for method validateCustom()
208
219
$ mainSetting = StringUtility::getValuesBeforeBrackets ($ validationSetting );
Original file line number Diff line number Diff line change @@ -26,9 +26,12 @@ public function initializeArguments()
26
26
*/
27
27
public function render ()
28
28
{
29
- $ settings = $ this ->arguments ['settings ' ];
29
+ // $settings = $this->arguments['settings'];
30
30
$ controllerName = strtolower ($ this ->renderingContext ->getControllerContext ()->getRequest ()->getControllerName ());
31
+
32
+ // return ExtensionManagementUtility::isLoaded('sr_freecap')
33
+ // && !empty($settings[$controllerName]['validation']['captcha']['captcha']);
31
34
return ExtensionManagementUtility::isLoaded ('sr_freecap ' )
32
- && ! empty ( $ settings[ $ controllerName][ ' validation ' ][ ' captcha ' ][ ' captcha '] );
35
+ && $ this -> templateVariableContainer -> getByPath ( ' settings. ' . $ controllerName . ' . validation. captcha. captcha ' );
33
36
}
34
37
}
Original file line number Diff line number Diff line change 87
87
<trans-unit id =" tx_femanager_domain_model_user.image" >
88
88
<source >Image</source >
89
89
</trans-unit >
90
+ <trans-unit id =" tx_femanager_domain_model_user.captcha" >
91
+ <source >Captcha</source >
92
+ </trans-unit >
90
93
<trans-unit id =" tx_femanager_domain_model_user.terms" >
91
94
<source >I accept the terms and conditions</source >
92
95
</trans-unit >
Original file line number Diff line number Diff line change 10
10
id ="femanager_field_captcha "
11
11
name ="captcha "
12
12
class ="form-control "
13
- additionalAttributes ="{data-validation:'required' } "
13
+ additionalAttributes ="{femanager:Validation.FormValidationData(settings:settings,fieldName:'captcha') } "
14
14
title ="{freeCap:translate(key:'notice')} {freeCap:translate(key:'explain')} " />
15
15
< freeCap:image />
16
16
< freeCap:audio />
You can’t perform that action at this time.
0 commit comments