Subversion Repositories oidplus

Rev

Rev 635 | Rev 790 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 635 Rev 702
Line 27... Line 27...
27
 
27
 
28
                        if (!OIDplus::mailUtils()->validMailAddress($email)) {
28
                        if (!OIDplus::mailUtils()->validMailAddress($email)) {
29
                                throw new OIDplusException(_L('Invalid email address'));
29
                                throw new OIDplusException(_L('Invalid email address'));
30
                        }
30
                        }
31
 
31
 
32
                        if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false)) {
-
 
33
                                $secret=OIDplus::baseConfig()->getValue('RECAPTCHA_PRIVATE', '');
32
                        OIDplus::getActiveCaptchaPlugin()->captchaVerify($params, 'captcha');
34
                                $response=$params["captcha"];
-
 
35
                                $verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}");
-
 
36
                                $captcha_success=json_decode($verify);
-
 
37
                                if ($captcha_success->success==false) {
-
 
38
                                        throw new OIDplusException(_L('CAPTCHA not successfully verified'));
-
 
39
                                }
-
 
40
                        }
-
 
41
 
33
 
42
                        $this->inviteSecurityCheck($email);
34
                        $this->inviteSecurityCheck($email);
43
                        // TODO: should we also log who has invited?
35
                        // TODO: should we also log who has invited?
44
                        OIDplus::logger()->log("[INFO]RA($email)!", "RA '$email' has been invited");
36
                        OIDplus::logger()->log("[INFO]RA($email)!", "RA '$email' has been invited");
45
 
37
 
Line 130... Line 122...
130
                                $cont = $this->getInvitationText($email);
122
                                $cont = $this->getInvitationText($email);
131
 
123
 
132
                                $out['text'] .= '<p>'._L('You have chosen to invite %1 as a Registration Authority. If you click "Send", the following email will be sent to %2:','<b>'.$email.'</b>',$email).'</p><p><i>'.nl2br(htmlentities($cont)).'</i></p>
124
                                $out['text'] .= '<p>'._L('You have chosen to invite %1 as a Registration Authority. If you click "Send", the following email will be sent to %2:','<b>'.$email.'</b>',$email).'</p><p><i>'.nl2br(htmlentities($cont)).'</i></p>
133
                                  <form id="inviteForm" action="javascript:void(0);" onsubmit="return OIDplusPageRaInvite.inviteFormOnSubmit();">
125
                                  <form id="inviteForm" action="javascript:void(0);" onsubmit="return OIDplusPageRaInvite.inviteFormOnSubmit();">
134
                                    <input type="hidden" id="email" value="'.htmlentities($email).'"/>
126
                                    <input type="hidden" id="email" value="'.htmlentities($email).'"/>
135
                                    <input type="hidden" id="origin" value="'.htmlentities($origin).'"/>'.
127
                                    <input type="hidden" id="origin" value="'.htmlentities($origin).'"/>
136
                                 (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false) ?
128
                                    '.OIDplus::getActiveCaptchaPlugin()->captchaGenerate().'
137
                                 '<div id="g-recaptcha" class="g-recaptcha" data-sitekey="'.OIDplus::baseConfig()->getValue('RECAPTCHA_PUBLIC', '').'"></div>'.
-
 
138
                                 '<script> grecaptcha.render($("#g-recaptcha")[0], { "sitekey" : "'.OIDplus::baseConfig()->getValue('RECAPTCHA_PUBLIC', '').'" }); </script>' : '').
-
 
139
                                ' <br>
129
                                    <br>
140
                                    <input type="submit" value="'._L('Send invitation').'">
130
                                    <input type="submit" value="'._L('Send invitation').'">
141
                                  </form>';
131
                                  </form>';
142
 
132
 
143
                        } catch (Exception $e) {
133
                        } catch (Exception $e) {
144
 
134