function abdulrauf_adminreCaptcha_validatereCaptcha() { include 'captcha.php'; if ($resp != null && $resp->success) { //reCaptcha validated return true; } else { yourls_do_action('login_failed'); yourls_login_screen($error_msg = 'reCaptcha validation failed'); die; return false; } }
<?php // No direct call if (!defined('YOURLS_ABSPATH')) { die; } $auth = yourls_is_valid_user(); if ($auth !== true) { // API mode, if (yourls_is_API()) { $format = isset($_REQUEST['format']) ? $_REQUEST['format'] : 'xml'; $callback = isset($_REQUEST['callback']) ? $_REQUEST['callback'] : ''; yourls_api_output($format, array('simple' => $auth, 'message' => $auth, 'errorCode' => 403, 'callback' => $callback)); // Regular mode } else { yourls_login_screen($auth); } die; } yourls_do_action('auth_successful');
/** * Yourls filter is_valid_user * * @param $value * @return bool */ public function filter_is_valid_user($value) { if (true === $value) { return true; } $username = $this->getRequest('username'); $password = $this->getRequest('password'); if ($username && $password) { try { $this->_ldap->auth($username, $password); } catch (Exception $e) { yourls_login_screen($this->mapLdapException($e)); die; } yourls_set_user($username); $this->setSession('login', [$username => 'phpass:'******'groups', $this->_ldap->getGroups()); $this->action_pre_login(); return true; } return false; }