Subversion Repositories oidplus

Rev

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

Rev 635 Rev 702
Line 43... Line 43...
43
echo '  <title>'._L('OIDplus Setup').'</title>';
43
echo '  <title>'._L('OIDplus Setup').'</title>';
44
echo '  <meta name="robots" content="noindex">';
44
echo '  <meta name="robots" content="noindex">';
45
echo '  <meta name="viewport" content="width=device-width, initial-scale=1.0">';
45
echo '  <meta name="viewport" content="width=device-width, initial-scale=1.0">';
46
echo '  <link rel="stylesheet" href="../../../../setup/setup.min.css.php">';
46
echo '  <link rel="stylesheet" href="../../../../setup/setup.min.css.php">';
47
echo '  <link rel="shortcut icon" type="image/x-icon" href="../../../../favicon.ico.php">';
47
echo '  <link rel="shortcut icon" type="image/x-icon" href="../../../../favicon.ico.php">';
48
if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false)) {
48
echo OIDplus::getActiveCaptchaPlugin()->captchaDomHead();
49
        echo '  <script src="https://www.google.com/recaptcha/api.js"></script>';
-
 
50
}
-
 
51
echo '</head>';
49
echo '</head>';
52
 
50
 
53
echo '<body>';
51
echo '<body>';
54
 
52
 
55
echo '<h1>'._L('OIDplus Setup - Initial Settings').'</h1>';
53
echo '<h1>'._L('OIDplus Setup - Initial Settings').'</h1>';
Line 62... Line 60...
62
echo '<p>'._L('The following settings need to be configured once.<br>After setup is complete, you can change all these settings through the admin login area, if necessary.').'</p>';
60
echo '<p>'._L('The following settings need to be configured once.<br>After setup is complete, you can change all these settings through the admin login area, if necessary.').'</p>';
63
 
61
 
64
echo '<form method="POST" action="oobe.php">';
62
echo '<form method="POST" action="oobe.php">';
65
echo '<input type="hidden" name="sent" value="1">';
63
echo '<input type="hidden" name="sent" value="1">';
66
 
64
 
67
if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false)) {
65
if (OIDplus::getActiveCaptchaPlugin()::id() !== 'None') {
68
        echo '<p><u>'._L('Step %1: Solve CAPTCHA',$step++).'</u></p>';
66
        echo '<p><u>'._L('Step %1: Solve CAPTCHA',$step++).'</u></p>';
69
        echo '<noscript>';
-
 
70
        echo '<p><font color="red">'._L('You need to enable JavaScript to solve the CAPTCHA.').'</font></p>';
-
 
71
        echo '</noscript>';
-
 
72
        echo '<p>'._L('Before logging in, please solve the following CAPTCHA').'</p>';
-
 
73
        echo '<p>'._L('If the CAPTCHA does not work (e.g. because of wrong keys, please run <a href="%1">setup part 1</a> again or edit %2 manually).',OIDplus::webpath().'setup/','userdata/baseconfig/config.inc.php').'</p>';
-
 
74
        echo '<div id="g-recaptcha" class="g-recaptcha" data-sitekey="'.OIDplus::baseConfig()->getValue('RECAPTCHA_PUBLIC', '').'"></div>';
-
 
75
        echo '<script> grecaptcha.render($("#g-recaptcha")[0], { "sitekey" : "'.OIDplus::baseConfig()->getValue('RECAPTCHA_PUBLIC', '').'" }); </script>';
-
 
76
 
-
 
77
        if (isset($_REQUEST['sent'])) {
67
        if (isset($_REQUEST['sent'])) {
78
                $secret=OIDplus::baseConfig()->getValue('RECAPTCHA_PRIVATE', '');
-
 
79
                _CheckParamExists($_POST, 'g-recaptcha-response');
-
 
80
                $response=$_POST["g-recaptcha-response"];
68
                try {
81
                $verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}");
-
 
82
                $captcha_success=json_decode($verify);
69
                        OIDplus::getActiveCaptchaPlugin()->captchaVerify($_POST);
83
                if ($captcha_success->success==false) {
70
                } catch (Exception $e) {
84
                        echo '<p><font color="red"><b>CAPTCHA not successfully verified</b></font></p>';
71
                        echo '<p><font color="red"><b>'.htmlentities($e->getMessage()).'</b></font></p>';
85
                        $errors_happened = true;
72
                        $errors_happened = true;
86
                        $edits_possible = false;
73
                        $edits_possible = false;
87
                }
74
                }
88
        }
75
        }
-
 
76
        echo OIDplus::getActiveCaptchaPlugin()->captchaGenerate(_L('Before logging in, please solve the following CAPTCHA'), _L('If the CAPTCHA does not work (e.g. because of wrong keys, please run <a href="%1">setup part 1</a> again or edit %2 manually).',OIDplus::webpath().'setup/','userdata/baseconfig/config.inc.php'));
89
}
77
}
90
 
78
 
91
echo '<p><u>'._L('Step %1: Authenticate',$step++).'</u></p>';
79
echo '<p><u>'._L('Step %1: Authenticate',$step++).'</u></p>';
92
 
80
 
93
if (OIDplus::authUtils()->isAdminLoggedIn()) {
81
if (OIDplus::authUtils()->isAdminLoggedIn()) {