Check for apppass option in login api
This commit is contained in:
parent
22fb97d0c4
commit
04702f6090
@ -8,7 +8,17 @@
|
|||||||
|
|
||||||
engageRateLimit();
|
engageRateLimit();
|
||||||
$user = User::byUsername($VARS['username']);
|
$user = User::byUsername($VARS['username']);
|
||||||
if ((!$user->has2fa() && $user->checkPassword($VARS['password'])) || $user->checkAppPassword($VARS['password'])) {
|
|
||||||
|
$ok = false;
|
||||||
|
if (empty($VARS['apppass']) && ($user->checkPassword($VARS['password']) || $user->checkAppPassword($VARS['password']))) {
|
||||||
|
$ok = true;
|
||||||
|
} else {
|
||||||
|
if ((!$user->has2fa() && $user->checkPassword($VARS['password'])) || $user->checkAppPassword($VARS['password'])) {
|
||||||
|
$ok = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ok) {
|
||||||
switch ($user->getStatus()->getString()) {
|
switch ($user->getStatus()->getString()) {
|
||||||
case "LOCKED_OR_DISABLED":
|
case "LOCKED_OR_DISABLED":
|
||||||
Log::insert(LogType::API_LOGIN_FAILED, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
Log::insert(LogType::API_LOGIN_FAILED, $uid, "Username: " . strtolower($VARS['username']) . ", Key: " . getCensoredKey());
|
||||||
|
@ -70,7 +70,8 @@ $APIS = [
|
|||||||
"load" => "login.php",
|
"load" => "login.php",
|
||||||
"vars" => [
|
"vars" => [
|
||||||
"username" => "string",
|
"username" => "string",
|
||||||
"password" => "string"
|
"password" => "string",
|
||||||
|
"apppass (optional)" => "/[0-1]/"
|
||||||
],
|
],
|
||||||
"keytype" => "AUTH"
|
"keytype" => "AUTH"
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user