Esempio n. 1
0
    }
});
$app->post('/resetPassword', function () use($app) {
    require_once 'passwordHash.php';
    $response = array();
    $r = json_decode($app->request->getBody());
    $password_non = $r->password;
    if (strtolower($password) == $password_non) {
        $response["status"] = "error";
        $response["message"] = "Need at least 1 capital letter in password";
        echoResponse(201, $response);
        $app->stop();
    }
    if (!preg_match('/[0-9]+/', $password_non)) {
        $response["status"] = "error";
        $response["message"] = "Need at least 1 number in password";
        echoResponse(201, $response);
        $app->stop();
    }
    $password = passwordHash::hash($password_non);
    $key = $r->key;
    $db = new DbHandler();
    $dbemail = $db->getOneRecord("select email from confirm where validation_key='{$key}'");
    $email = $dbemail['email'];
    $dbuid = $db->getOneRecord("select uid from users where email='{$email}'");
    $uid = $dbuid['uid'];
    $db->updateOneRecord("update users set password = '******' where uid='{$uid}'");
    $response["status"] = "success";
    $response["message"] = "Account password sucessfully reset.";
    echoResponse(200, $response);
});
Esempio n. 2
0
    $response["status"] = "success";
    $response["message"] = "Moved '{$tm}' to '{$tn}'";
    echoResponse(200, $response);
});
$app->post('/removeTM', function () use($app) {
    $response = array();
    $r = json_decode($app->request->getBody());
    $tm = $r->tm;
    if ($tm == "") {
        $response["status"] = "error";
        $response["message"] = "Cannot remove '{$tm}' Select valid teammate.";
        echoResponse(200, $response);
        $app->stop();
    }
    $db = new DbHandler();
    $db->updateOneRecord("update users set teamname = NULL where name='{$tm}'");
    $response["status"] = "success";
    $response["message"] = "Removed '{$tm}'";
    echoResponse(200, $response);
});
$app->post('/assignRole', function () use($app) {
    $response = array();
    $r = json_decode($app->request->getBody());
    $fr = $r->fr;
    $rc = $r->rc;
    $db = new DbHandler();
    $result = $db->getOneRecord("select uid,teamname from users where name='{$fr}'");
    $confirm_tabble_name = "user_roles";
    $confirm_column_names = array('id', 'name', 'teamname', 'role', 'uid');
    $content = array('id' => 'NULL', 'name' => $fr, 'teamname' => $result['teamname'], 'role' => $rc, 'uid' => $result['uid']);
    $object = json_decode(json_encode($content), FALSE);