API: Allow getting profile of own account with just a key
This commit is contained in:
parent
e4227dd644
commit
b8501da3eb
@ -6,11 +6,15 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
if (!$database->has("accounts", ["publicid" => $VARS["id"]])) {
|
||||
sendJsonResp($Strings->get("Could not find a matching account.", false), "ERROR");
|
||||
}
|
||||
if (empty($VARS["id"])) {
|
||||
$profile = $database->get("accounts", ["[>]authkeys" => ["accountid"]], ["publicid", "name", "username", "type", "verified"], ["key" => $VARS["key"]]);
|
||||
} else {
|
||||
if (!$database->has("accounts", ["publicid" => $VARS["id"]])) {
|
||||
sendJsonResp($Strings->get("Could not find a matching account.", false), "ERROR");
|
||||
}
|
||||
|
||||
$profile = $database->get("accounts", ["publicid", "name", "username", "type", "verified"], ["publicid" => $VARS["id"]]);
|
||||
$profile = $database->get("accounts", ["publicid", "name", "username", "type", "verified"], ["publicid" => $VARS["id"]]);
|
||||
}
|
||||
|
||||
// Make sure the name field always has something useful
|
||||
if (empty($profile["name"])) {
|
||||
|
@ -63,7 +63,7 @@ $APIS = [
|
||||
"load" => "profile.php",
|
||||
"vars" => [
|
||||
"key" => $keyregex,
|
||||
"id" => "/[0-9a-z]+/"
|
||||
"id (optional)" => "/[0-9a-z]+/"
|
||||
]
|
||||
]
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user