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 23... | Line 23... | ||
23 | 23 | ||
24 | public function action($actionID, $params) { |
24 | public function action($actionID, $params) { |
25 | // === RA LOGIN/LOGOUT === |
25 | // === RA LOGIN/LOGOUT === |
26 | 26 | ||
27 | if ($actionID == 'ra_login') { |
27 | if ($actionID == 'ra_login') { |
28 | if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false)) { |
- | |
29 | $secret=OIDplus::baseConfig()->getValue('RECAPTCHA_PRIVATE', ''); |
- | |
30 | _CheckParamExists($params, 'captcha'); |
28 | OIDplus::getActiveCaptchaPlugin()->captchaVerify($params, 'captcha'); |
31 | $response=$params["captcha"]; |
- | |
32 | $verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}"); |
- | |
33 | $captcha_success=json_decode($verify); |
- | |
34 | if ($captcha_success->success==false) { |
- | |
35 | throw new OIDplusException(_L('CAPTCHA not successfully verified')); |
- | |
36 | } |
- | |
37 | } |
- | |
38 | 29 | ||
39 | _CheckParamExists($params, 'email'); |
30 | _CheckParamExists($params, 'email'); |
40 | _CheckParamExists($params, 'password'); |
31 | _CheckParamExists($params, 'password'); |
41 | 32 | ||
42 | $email = $params['email']; |
33 | $email = $params['email']; |
Line 76... | Line 67... | ||
76 | } |
67 | } |
77 | 68 | ||
78 | // === ADMIN LOGIN/LOGOUT === |
69 | // === ADMIN LOGIN/LOGOUT === |
79 | 70 | ||
80 | else if ($actionID == 'admin_login') { |
71 | else if ($actionID == 'admin_login') { |
81 | if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false)) { |
- | |
82 | $secret=OIDplus::baseConfig()->getValue('RECAPTCHA_PRIVATE', ''); |
- | |
83 | _CheckParamExists($params, 'captcha'); |
72 | OIDplus::getActiveCaptchaPlugin()->captchaVerify($params, 'captcha'); |
84 | $response=$params["captcha"]; |
- | |
85 | $verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}"); |
- | |
86 | $captcha_success=json_decode($verify); |
- | |
87 | if ($captcha_success->success==false) { |
- | |
88 | throw new OIDplusException(_L('CAPTCHA not successfully verified')); |
- | |
89 | } |
- | |
90 | } |
- | |
91 | 73 | ||
92 | _CheckParamExists($params, 'password'); |
74 | _CheckParamExists($params, 'password'); |
93 | if (OIDplus::authUtils()->adminCheckPassword($params['password'])) { |
75 | if (OIDplus::authUtils()->adminCheckPassword($params['password'])) { |
94 | $remember_me = isset($params['remember_me']) && ($params['remember_me']); |
76 | $remember_me = isset($params['remember_me']) && ($params['remember_me']); |
95 | OIDplus::authUtils()->adminLoginEx($remember_me, 'Regular login'); |
77 | OIDplus::authUtils()->adminLoginEx($remember_me, 'Regular login'); |
Line 149... | Line 131... | ||
149 | $out['text'] .= '<noscript>'; |
131 | $out['text'] .= '<noscript>'; |
150 | $out['text'] .= '<p>'._L('You need to enable JavaScript to use the login area.').'</p>'; |
132 | $out['text'] .= '<p>'._L('You need to enable JavaScript to use the login area.').'</p>'; |
151 | $out['text'] .= '</noscript>'; |
133 | $out['text'] .= '</noscript>'; |
152 | 134 | ||
153 | $out['text'] .= '<div id="loginArea" style="visibility: hidden"><div id="loginTab" class="container" style="width:100%;">'; |
135 | $out['text'] .= '<div id="loginArea" style="visibility: hidden"><div id="loginTab" class="container" style="width:100%;">'; |
154 | $out['text'] .= (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false) ? |
- | |
- | 136 | ||
155 | '<p>'._L('Before logging in, please solve the following CAPTCHA').'</p>'. |
137 | $out['text'] .= OIDplus::getActiveCaptchaPlugin()->captchaGenerate(_L('Before logging in, please solve the following CAPTCHA')); |
156 | '<div id="g-recaptcha" class="g-recaptcha" data-sitekey="'.OIDplus::baseConfig()->getValue('RECAPTCHA_PUBLIC', '').'"></div>'. |
- | |
157 | '<script> grecaptcha.render($("#g-recaptcha")[0], { "sitekey" : "'.OIDplus::baseConfig()->getValue('RECAPTCHA_PUBLIC', '').'" }); </script>' : ''); |
- | |
158 | $out['text'] .= '<br>'; |
138 | $out['text'] .= '<br>'; |
159 | 139 | ||
160 | // ---------------- Tab control |
140 | // ---------------- Tab control |
161 | $out['text'] .= OIDplus::gui()->tabBarStart(); |
141 | $out['text'] .= OIDplus::gui()->tabBarStart(); |
162 | $out['text'] .= OIDplus::gui()->tabBarElement('ra', _L('Login as RA'), $tab === 'ra'); |
142 | $out['text'] .= OIDplus::gui()->tabBarElement('ra', _L('Login as RA'), $tab === 'ra'); |