Only check if a nickname exists if site is non-private

This commit is contained in:
Mikael Nordfeldth 2015-01-21 22:06:27 +01:00
parent 8b585ff647
commit ce9d18c29d

View File

@ -5,7 +5,7 @@
* *
* Check nickname * Check nickname
* *
* Returns 1 if nickname is ok, 0 if not * Returns 1 if nickname is available on this instance, 0 if not. Error if site is private.
* *
* PHP version 5 * PHP version 5
* *
@ -38,6 +38,10 @@ class ApiCheckNicknameAction extends ApiAction
{ {
parent::prepare($args); parent::prepare($args);
if (common_config('site', 'private')) {
$this->clientError(_('This site is private.'), 403);
}
if ($this->format !== 'json') { if ($this->format !== 'json') {
$this->clientError('This method currently only serves JSON.', 415); $this->clientError('This method currently only serves JSON.', 415);
} }