<?php
require("../snippets/autoload.php");

$entity = new UserAccount();
$rules = array();
$exclude = array();

SanitizeRequest($rules, $exclude);

$entity->Password = $_POST["Password"];
if( strlen($entity->Password)<7 ){
    $response_request["type"] = "error";
    $response_request["title"] = _("Error presented");
    $response_request["content"] = _("Password must have at least 7 chars.");
}else{
    $entity->Id = $utils->SanitizeString($_POST["Id"]);
    if($entity->UpdatePassword()){
        $response_request["type"] = "success";
        $response_request["title"] = _("Success");
        $response_request["content"] = _("Password was updates");
    }else{
        $response_request["type"] = "error";
        $response_request["title"] = _("Error presented");
        $response_request["content"] = _("Please, try again");
    }
}
echo json_encode($response_request);