X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fapiauth.php;h=0d1613d381ed17de89be5410b47e1b7df2f04637;hb=69ac99ff949ab0118ff25a62471980ad0ec7a52b;hp=25bbae24e53dfaf2c75e1eacdc37113792e6f17f;hpb=e071a8cbffd8eaf63f2d92e15edc2f6f25d9c984;p=quix0rs-gnu-social.git diff --git a/lib/apiauth.php b/lib/apiauth.php index 25bbae24e5..0d1613d381 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -21,7 +21,14 @@ * * @category API * @package StatusNet - * @author Zach Copley + * @author Adrian Lang + * @author Brenda Wallace + * @author Craig Andrews + * @author Dan Moore + * @author Evan Prodromou + * @author mEDI + * @author Sarven Capadisli + * @author Zach Copley * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ @@ -31,7 +38,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/api.php'; +require_once INSTALLDIR . '/lib/api.php'; /** * Actions extending this class will require auth @@ -90,8 +97,10 @@ class ApiAuthAction extends ApiAction { $this->basicAuthProcessHeader(); + $realm = common_config('site', 'name') . ' API'; + if (!isset($this->auth_user)) { - header('WWW-Authenticate: Basic realm="StatusNet API"'); + header('WWW-Authenticate: Basic realm="' . $realm . '"'); // show error if the user clicks 'cancel' @@ -101,7 +110,11 @@ class ApiAuthAction extends ApiAction } else { $nickname = $this->auth_user; $password = $this->auth_pw; - $this->auth_user = common_check_user($nickname, $password); + $user = common_check_user($nickname, $password); + if (Event::handle('StartSetApiUser', array(&$user))) { + $this->auth_user = $user; + Event::handle('EndSetApiUser', array($user)); + } if (empty($this->auth_user)) {