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 28... Line 28...
28
 
28
 
29
                        if (!OIDplus::mailUtils()->validMailAddress($email)) {
29
                        if (!OIDplus::mailUtils()->validMailAddress($email)) {
30
                                throw new OIDplusException(_L('Invalid email address'));
30
                                throw new OIDplusException(_L('Invalid email address'));
31
                        }
31
                        }
32
 
32
 
33
                        if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false)) {
-
 
34
                                _CheckParamExists($params, 'captcha');
33
                        OIDplus::getActiveCaptchaPlugin()->captchaVerify($params, 'captcha');
35
                                $secret=OIDplus::baseConfig()->getValue('RECAPTCHA_PRIVATE', '');
-
 
36
                                $response=$params["captcha"];
-
 
37
                                $verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}");
-
 
38
                                $captcha_success=json_decode($verify);
-
 
39
                                if ($captcha_success->success==false) {
-
 
40
                                        throw new OIDplusException(_L('CAPTCHA not successfully verified'));
-
 
41
                                }
-
 
42
                        }
-
 
43
 
34
 
44
                        OIDplus::logger()->log("[WARN]RA($email)!", "A new password for '$email' was requested (forgot password)");
35
                        OIDplus::logger()->log("[WARN]RA($email)!", "A new password for '$email' was requested (forgot password)");
45
 
36
 
46
                        $timestamp = time();
37
                        $timestamp = time();
47
                        $activate_url = OIDplus::webpath(null,false) . '?goto='.urlencode('oidplus:reset_password$'.$email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('reset_password;'.$email.';'.$timestamp));
38
                        $activate_url = OIDplus::webpath(null,false) . '?goto='.urlencode('oidplus:reset_password$'.$email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('reset_password;'.$email.';'.$timestamp));
Line 111... Line 102...
111
                        $out['icon'] = OIDplus::webpath(__DIR__).'forgot_password_big.png';
102
                        $out['icon'] = OIDplus::webpath(__DIR__).'forgot_password_big.png';
112
 
103
 
113
                        try {
104
                        try {
114
                                $out['text'] .= '<p>'._L('Please enter the email address of your account, and information about the password reset will be sent to you.').'</p>
105
                                $out['text'] .= '<p>'._L('Please enter the email address of your account, and information about the password reset will be sent to you.').'</p>
115
                                  <form id="forgotPasswordForm" action="javascript:void(0);" onsubmit="return OIDplusPagePublicForgotPassword.forgotPasswordFormOnSubmit();">
106
                                  <form id="forgotPasswordForm" action="javascript:void(0);" onsubmit="return OIDplusPagePublicForgotPassword.forgotPasswordFormOnSubmit();">
116
                                    '._L('E-Mail').': <input type="text" id="email" value=""/><br><br>'.
107
                                    '._L('E-Mail').': <input type="text" id="email" value=""/><br><br>
117
                                 (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false) ?
108
                                    '.OIDplus::getActiveCaptchaPlugin()->captchaGenerate().'
118
                                 '<div id="g-recaptcha" class="g-recaptcha" data-sitekey="'.OIDplus::baseConfig()->getValue('RECAPTCHA_PUBLIC', '').'"></div>'.
-
 
119
                                 '<script> grecaptcha.render($("#g-recaptcha")[0], { "sitekey" : "'.OIDplus::baseConfig()->getValue('RECAPTCHA_PUBLIC', '').'" }); </script>' : '').
-
 
120
                                ' <br>
109
                                    <br>
121
                                    <input type="submit" value="'._L('Send recovery information').'">
110
                                    <input type="submit" value="'._L('Send recovery information').'">
122
                                  </form>';
111
                                  </form>';
123
 
112
 
124
                        } catch (Exception $e) {
113
                        } catch (Exception $e) {
125
 
114