Simplified code

This commit is contained in:
Michael 2021-06-08 08:04:12 +00:00
parent 8cde7fe51f
commit 85217941e3

View file

@ -191,12 +191,12 @@ class BaseApi extends BaseModule
*/ */
protected static function login(string $scope) protected static function login(string $scope)
{ {
$token = OAuth::getCurrentApplicationToken(); $uid = OAuth::getCurrentUserID();
if (!empty($token)) {
if (!empty($uid)) {
if (!OAuth::isAllowedScope($scope)) { if (!OAuth::isAllowedScope($scope)) {
DI::mstdnError()->Forbidden(); DI::mstdnError()->Forbidden();
} }
$uid = OAuth::getCurrentUserID();
} }
if (empty($uid)) { if (empty($uid)) {