Cofem/endpoints/global/account.php

37 lines
1.5 KiB
PHP
Raw Normal View History

2024-01-18 11:49:38 +01:00
<?php
require_once "lib/account.php";
function endpoint($endpoint_data): array
2024-01-18 11:49:38 +01:00
{
return match ($endpoint_data["action"]) {
"login" => doLogin($endpoint_data["email"], $endpoint_data["password"]),
"logout" => doLogout(),
"register" => doRegister(
$endpoint_data["firstname"],
$endpoint_data["lastname"],
$endpoint_data["nickname"],
$endpoint_data["email"],
$endpoint_data["password"],
$endpoint_data["minecraftnick"],
$endpoint_data["activation_token"]
),
"change_password" => changePassword($endpoint_data["user_id"], $endpoint_data["new_password"]),
"update_user_profile" => updateUserProfile(
$endpoint_data["user_id"],
$endpoint_data["first_name"],
$endpoint_data["last_name"],
$endpoint_data["nickname"],
$endpoint_data["minecraft_nick"]
),
"get_user_info" => getUserInfo($endpoint_data["user_id"]),
"is_email_available" => isEmailAvailable($endpoint_data["email"]),
"add_activation_codes" => addActivationCodes($endpoint_data["count"]),
"list_users" => listUsers(),
"list_activation_codes" => listActivationCodes(),
"delete_user" => deleteUser($endpoint_data["user_id"]),
"delete_activation_code" => deleteActivationCode($endpoint_data["activation_code"]),
default => ["status" => "fail", "message" => "Invalid action"],
};
}