Subversion Repositories oidplus

Rev

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

Rev 1018 Rev 1022
Line 84... Line 84...
84
                        throw new OIDplusException(_L('CAPTCHA not successfully verified').' (Web request failed)');
84
                        throw new OIDplusException(_L('CAPTCHA not successfully verified').' (Web request failed)');
85
                }
85
                }
86
                $captcha_success=@json_decode($verify);
86
                $captcha_success=@json_decode($verify);
87
                $SCORE_THRESHOLD = 0.5; // TODO: Make Score configurable (only V3)
87
                $SCORE_THRESHOLD = 0.5; // TODO: Make Score configurable (only V3)
88
                if (!$captcha_success) {
88
                if (!$captcha_success) {
89
                        throw new OIDplusException(_L('CAPTCHA not successfully verified').' (JSON Decode failed)');
89
                        throw new OIDplusException(_L('CAPTCHA not successfully verified').' ('._L('JSON Decode failed').')');
90
                }
90
                }
91
                if ($captcha_success->success==false) {
91
                if ($captcha_success->success==false) {
92
                        throw new OIDplusException(_L('CAPTCHA not successfully verified').' (Failed)');
92
                        throw new OIDplusException(_L('CAPTCHA not successfully verified').' ('._L('Failed').')');
93
                }
93
                }
94
                if (isset($captcha_success->score) && ($captcha_success->score < $SCORE_THRESHOLD)) {
94
                if (isset($captcha_success->score) && ($captcha_success->score < $SCORE_THRESHOLD)) {
95
                        throw new OIDplusException(_L('CAPTCHA not successfully verified').' (Score '.($captcha_success->score).' too low)');
95
                        throw new OIDplusException(_L('CAPTCHA not successfully verified').' ('._L('Score %1 too low', $captcha_success->score).')');
96
                }
96
                }
97
        }
97
        }
98
 
98
 
99
        public static function setupHTML(): string {
99
        public static function setupHTML(): string {
100
                return '<div id="CAPTCHAPLUGIN_PARAMS_RECAPTCHA">'.
100
                return '<div id="CAPTCHAPLUGIN_PARAMS_RECAPTCHA">'.