mirror of
https://git.code.sf.net/p/seeddms/code
synced 2026-02-10 18:41:58 +00:00
add action addapikey
This commit is contained in:
parent
c2a10fa0a9
commit
ee490b1c7f
|
|
@ -497,6 +497,35 @@ else if ($action == "edituser") {
|
|||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_user')));
|
||||
add_log_line(".php&action=edituser&userid=".$userid);
|
||||
}
|
||||
|
||||
// modify user ------------------------------------------------------------
|
||||
else if ($action == "addapikey") {
|
||||
|
||||
/* Check if the form data comes from a trusted request */
|
||||
if(!checkFormKey('addapikey')) {
|
||||
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
|
||||
}
|
||||
|
||||
if (!isset($_POST["userid"]) || !is_numeric($_POST["userid"]) || intval($_POST["userid"])<1) {
|
||||
UI::exitError(getMLText("admin_tools"),getMLText("invalid_user_id"));
|
||||
}
|
||||
|
||||
$userid=$_POST["userid"];
|
||||
$editedUser = $dms->getUser($userid);
|
||||
|
||||
if (!is_object($editedUser)) {
|
||||
UI::exitError(getMLText("admin_tools"),getMLText("invalid_user_id"));
|
||||
}
|
||||
|
||||
$apikey = $_POST["apikey"];
|
||||
|
||||
$newapikey = $dms->addApiKey($apikey, $editedUser);
|
||||
if ($newapikey) {
|
||||
}
|
||||
else UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
||||
|
||||
|
||||
}
|
||||
else UI::exitError(getMLText("admin_tools"),getMLText("unknown_command"));
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user