Example #1
0
});
$app->get('/manage/teams/:user_id', 'authenticateToken', function ($user_id) use($app) {
    global $db;
    $data = json_decode($app->request->getBody());
    $rows = Users_model::get_userManage($db, $user_id);
    echoResponse(200, $rows);
});
$app->get('/manage/users/:team_id', 'authenticateToken', function ($team_id) use($app) {
    global $db;
    $data = json_decode($app->request->getBody());
    $rows = Users_model::get_teamsManage($db, $team_id);
    echoResponse(200, $rows);
});
$app->delete('/manage/:team_id/:user_id', 'authenticateToken', function ($team_id, $user_id) use($app) {
    global $db;
    $rows = Users_model::delete_userManage($db, $team_id, $user_id);
    echoResponse(200, $rows);
});
$app->post('/forgot_password', function () use($app) {
    global $db;
    $data = json_decode($app->request->getBody());
    $user_email = $data->email;
    if (filter_var($user_email, FILTER_VALIDATE_EMAIL)) {
        $posted = [];
        $posted['hash'] = hash('sha256', $user_email);
        $posted['email'] = $user_email;
        $time = new DateTime('24 hours ago');
        $posted['time_formatted'] = $time->format('Y-m-d H:i:s');
        $processed = Users_model::forgotPasswordAction($db, $posted);
    }
    echoResponse(200, $processed);