Rev 635 | Rev 800 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 635 | Rev 702 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | 46 | ||
47 | if (!OIDplus::mailUtils()->validMailAddress($email)) { |
47 | if (!OIDplus::mailUtils()->validMailAddress($email)) { |
48 | throw new OIDplusException(_L('Invalid email address')); |
48 | throw new OIDplusException(_L('Invalid email address')); |
49 | } |
49 | } |
50 | 50 | ||
51 | if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false)) { |
- | |
52 | $secret=OIDplus::baseConfig()->getValue('RECAPTCHA_PRIVATE', ''); |
- | |
53 | _CheckParamExists($params, 'captcha'); |
51 | OIDplus::getActiveCaptchaPlugin()->captchaVerify($params, 'captcha'); |
54 | $response=$params["captcha"]; |
- | |
55 | $verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}"); |
- | |
56 | $captcha_success=json_decode($verify); |
- | |
57 | if ($captcha_success->success==false) { |
- | |
58 | throw new OIDplusException(_L('CAPTCHA not successfully verified')); |
- | |
59 | } |
- | |
60 | } |
- | |
61 | 52 | ||
62 | $root_oid = self::getFreeRootOid(false); |
53 | $root_oid = self::getFreeRootOid(false); |
63 | OIDplus::logger()->log("[INFO]OID(oid:$root_oid)+RA($email)!", "Requested a free OID for email '$email' to be placed into root '$root_oid'"); |
54 | OIDplus::logger()->log("[INFO]OID(oid:$root_oid)+RA($email)!", "Requested a free OID for email '$email' to be placed into root '$root_oid'"); |
64 | 55 | ||
65 | $timestamp = time(); |
56 | $timestamp = time(); |
Line 212... | Line 203... | ||
212 | $out['text'] .= '<p>'._L('Currently <a %1>%2 free OIDs have been</a> registered. Please enter your email below to receive a free OID.',OIDplus::gui()->link(self::getFreeRootOid(true)),$highest_id).'</p>'; |
203 | $out['text'] .= '<p>'._L('Currently <a %1>%2 free OIDs have been</a> registered. Please enter your email below to receive a free OID.',OIDplus::gui()->link(self::getFreeRootOid(true)),$highest_id).'</p>'; |
213 | 204 | ||
214 | try { |
205 | try { |
215 | $out['text'] .= ' |
206 | $out['text'] .= ' |
216 | <form id="freeOIDForm" action="javascript:void(0);" onsubmit="return OIDplusPagePublicFreeOID.freeOIDFormOnSubmit();"> |
207 | <form id="freeOIDForm" action="javascript:void(0);" onsubmit="return OIDplusPagePublicFreeOID.freeOIDFormOnSubmit();"> |
217 | '._L('E-Mail').': <input type="text" id="email" value=""/><br><br>'. |
208 | '._L('E-Mail').': <input type="text" id="email" value=""/><br><br> |
218 | (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false) ? |
209 | '.OIDplus::getActiveCaptchaPlugin()->captchaGenerate().' |
219 | '<div id="g-recaptcha" class="g-recaptcha" data-sitekey="'.OIDplus::baseConfig()->getValue('RECAPTCHA_PUBLIC', '').'"></div>'. |
- | |
220 | '<script> grecaptcha.render($("#g-recaptcha")[0], { "sitekey" : "'.OIDplus::baseConfig()->getValue('RECAPTCHA_PUBLIC', '').'" }); </script>' : ''). |
- | |
221 | ' <br> |
210 | <br> |
222 | <input type="submit" value="'._L('Request free OID').'"> |
211 | <input type="submit" value="'._L('Request free OID').'"> |
223 | </form>'; |
212 | </form>'; |
224 | 213 | ||
225 | $obj = OIDplusOid::parse(self::getFreeRootOid(true)); |
214 | $obj = OIDplusOid::parse(self::getFreeRootOid(true)); |
226 | 215 |