// header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]); // exit(); //}else if ($_SERVER['REQUEST_METHOD'] == 'POST' && csrf_check() === true && isset($_POST['userEmail']) && isset($_POST['newPassword']) && isset($_POST['vPassword']) && isset($_GET['token'])) { echo "<br>"; echo "restoring password..."; echo "<br>"; $password = trim($_POST['newPassword']); $vPassword = trim($_POST['vPassword']); $userEmail = trim($_POST['userEmail']); $token = trim($_GET['token']); $passwordValidationService = new \Validators\ValidatorService(); $validationStatus = $passwordValidationService->recoveryValidator($userEmail, $password, $vPassword); if ($validationStatus === 0) { $restoreService = new \PhpServicesKit\PasswordRecovery\RecoveryService(); $resetPassword = $restoreService->restoreNewPassword($userEmail, $password, $token); if ($resetPassword === 0) { echo "\n <meta name='viewport' content='width=device-width'/>\n <p style='color: lawngreen'>Password has been restored successfully</p>\n "; } else { echo "\n <meta name='viewport' content='width=device-width'/>\n <p style='color: red'>Error restoring password. Try again</p>\n "; } } else { echo "\n <meta name='viewport' content='width=device-width'/>\n <p style='color: red'>Missing data, incorrect or password too weak. You need at least 8 char password</p>\n "; } } elseif (isset($_GET['token'])) { echo ' <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, user-scalable=no"/>