static function process() { $dto = new \stdClass(); $dto->user = GenerarContraseniaController::getUserByCodes(); $dto->errors = array(); if (!isset($_POST["submit"]) || !$dto->user) { return $dto; } $dto->errors = GenerarContraseniaController::validate(); if (sizeof($dto->errors) > 0) { return $dto; } try { $dto->user->password = $_POST["password"]; $dto->errors = SecurityAdmin::changePasswordUser($dto->user); $dto->user = json_decode(json_encode($dto->user)); return $dto; } catch (\Exception $ex) { return array("Se produjo un error: " . $ex); } }
static function process() { if (!isset($_POST["submit"])) { return null; } $errors = CambioContraseniaController::validate(); if (sizeof($errors) > 0) { return $errors; } $user = SecurityManager::UserInfo(); $user->password = $_POST["newPassword"]; SecurityAdmin::changePasswordUser($user); return null; }