allenchow Posted May 7, 2019 Share Posted May 7, 2019 After I clicked and verified , it shows "Could not load SSL library" message For other project, the recaptcha not even show up. And the console show error : reCAPTCHA couldn't find user-provided function: onloadCallback (inside https://www.gstatic.com/recaptcha/api2/v1555968629716/recaptcha__en.js) Link to comment Share on other sites More sharing options...
allenchow Posted May 8, 2019 Author Share Posted May 8, 2019 The first one has been solved : put files libeay32.dll and ssleay32.dll Link to comment Share on other sites More sharing options...
allenchow Posted May 8, 2019 Author Share Posted May 8, 2019 The second one : when I put the recaptcha in Form2. When I click the button in main and call Form2.showmodal, the recpaptcha in form2 not appeared ! and the console with error : : reCAPTCHA couldn't find user-provided function: onloadCallback (inside https://www.gstatic.com/recaptcha/api2/v1555968629716/recaptcha__en.js) Link to comment Share on other sites More sharing options...
allenchow Posted May 8, 2019 Author Share Posted May 8, 2019 Please fix it . Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted May 8, 2019 Share Posted May 8, 2019 Can you please create a test case? I can not reproduce this issue Link to comment Share on other sites More sharing options...
allenchow Posted May 8, 2019 Author Share Posted May 8, 2019 only show in mainform temp (2).zip Link to comment Share on other sites More sharing options...
allenchow Posted May 9, 2019 Author Share Posted May 9, 2019 Any hint? Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted May 9, 2019 Share Posted May 9, 2019 Hello, I didn't expect someone use 2 recaptcha in the same time. Fixed. You will get with new build. For now you can change uniReCAPTCHA.pas file with this. unit UniReCAPTCHA; interface uses SysUtils, Classes, Controls, Forms, uniGUIBaseClasses, uniGUIClasses, uniPanel, uniHTMLFrame, uniGUITypes, uIdHTTP, uniGUIApplication; type TUniReCAPTCHA = class(TUniCustomHTMLFrame) private FSiteKey: string; FVerified: boolean; FOnVerified: TNotifyEvent; FSecretKey: String; procedure SetSiteKey(const Value: string); procedure SetSecretKey(const Value: String); { Private declarations } protected procedure LoadCompleted; override; procedure JSEventHandler(AEventName: string; AParams: TUniStrings);override; procedure BeforeLoadCompleted; override; public constructor Create(AOwner:TComponent); override; destructor Destroy; override; { Public declarations } published property SiteKey:string read FSiteKey write SetSiteKey; property SecretKey: String read FSecretKey write SetSecretKey; property Verified : boolean read FVerified; property OnVerified :TNotifyEvent read FOnVerified write FOnVerified; procedure Reset; { Published declarations } end; implementation { TUniReCAPTCHA } procedure TUniReCAPTCHA.BeforeLoadCompleted; var sWidth:string; begin inherited; if Trim(FSiteKey)='' then begin raise Exception.Create('UniReCAPTCHA : Please Set SiteKey'+ #13#10+' To Get SiteKey Please Visit : https://www.google.com/recaptcha/admin'); Exit; end; if Trim(FSecretKey)='' then begin raise Exception.Create('UniReCAPTCHA : Please Set SecretKey'+ #13#10+' To Get SecretKey Please Visit : https://www.google.com/recaptcha/admin'); Exit; end; JSCode(JSName+'OnCallBack = function() {ajaxRequest('+JSName+', "OnCallBack", {response: grecaptcha.getResponse()}) };'); sWidth:=StringReplace(FormatFloat('0.00',Width/302),',','.',[rfReplaceAll]); Height:=Trunc(76*Width/302); StaticHTML:=True; HTML.Text:='<div id="' + JSName + '_recaptcha" class="g-recaptcha" data-sitekey="'+FSiteKey+'" data-callback="'+JSName+'OnCallBack" style="transform:scale('+sWidth+');transform-origin:0 0" ></div>'; end; constructor TUniReCAPTCHA.Create(AOwner: TComponent); begin inherited; Width:=302; Height:=76; end; destructor TUniReCAPTCHA.Destroy; begin inherited; end; procedure TUniReCAPTCHA.JSEventHandler(AEventName: string; AParams: TUniStrings); var idHttp1: TIdHTTP; response: String; begin inherited; if AEventName='OnCallBack' then begin idHttp1:=TIdHTTP.Create(Self); try // idHttp1.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(idHttp1); // idHttp1.HandleRedirects := True; response := idHttp1.Get('https://www.google.com/recaptcha/api/siteverify?secret='+FSecretKey+'&response='+AParams['response'].AsString); if Pos('"success": true', response)>0 then begin FVerified:=True; if Assigned(OnVerified) then OnVerified(Self); end; finally idHttp1.Free; end; end; end; procedure TUniReCAPTCHA.LoadCompleted; begin inherited; JSCallGlobal('setTimeout', [JSFunction('','recaptcha = document.getElementById("' + JSName + '_recaptcha"); if (recaptcha) {grecaptcha.render(recaptcha);}'),100]); end; procedure TUniReCAPTCHA.Reset; begin FVerified:=False; JSCallGlobal('grecaptcha.reset',[]); end; procedure TUniReCAPTCHA.SetSecretKey(const Value: String); begin FSecretKey := Value; end; procedure TUniReCAPTCHA.SetSiteKey(const Value: string); begin FSiteKey := Value; end; initialization UniAddJSLibrary('https://www.google.com/recaptcha/api.js?render=explicit', True, [upoPlatformBoth]); end. Link to comment Share on other sites More sharing options...
allenchow Posted May 9, 2019 Author Share Posted May 9, 2019 I'm not using 2 recaptchas, I just show the demo to you that it only worked on the main form, Will try your solution, thanks ! Link to comment Share on other sites More sharing options...
ygerdel Posted August 12, 2019 Share Posted August 12, 2019 Hello, I'm trying to use two recaptchas in the same project and in the second recaptcha does not activate the OnVerified event. I attached a test case. TestCase_Recaptcha.zip Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted August 12, 2019 Share Posted August 12, 2019 1 hour ago, ygerdel said: Hello, I'm trying to use two recaptchas in the same project and in the second recaptcha does not activate the OnVerified event. I attached a test case. TestCase_Recaptcha.zip Link to comment Share on other sites More sharing options...
ygerdel Posted August 14, 2019 Share Posted August 14, 2019 It works perfectly. thanks a lot. Link to comment Share on other sites More sharing options...
pro_imaj Posted September 23, 2019 Share Posted September 23, 2019 On 8/12/2019 at 11:19 PM, Hayri ASLAN said: Hi, never encountered this problem when I change the server is the solution I'm having this problem? Thank you. Error Code Could not load SSL library. Thanks. Link to comment Share on other sites More sharing options...
pro_imaj Posted September 23, 2019 Share Posted September 23, 2019 4 hours ago, pro_imaj said: Hi, never encountered this problem when I change the server is the solution I'm having this problem? Thank you. Error Code Could not load SSL library. Thanks. The problem; improved when installed 32 bit dll files while Windows was 64 bit. Good work. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now