<?php
if (isset($_SESSION['id'])) {
if (isset($_POST['passwordEnter'])) {
$id1 = $_SESSION['id'];
if (isset($_POST['password']) && !preg_match('/^(?=.*\d)(?=.*[A-Z])(?=.*[a-z])[0-9A-Za-z_]{8,}$/', $_POST['password'])) {
echo "<script>if(!confirm('Not secure enough, The password must be minimum 8 characters and must contain lower case letter, upper case letter and number')){
window.location.reload();
}</script>";
} elseif (htmlspecialchars($_POST['newPassword']) == htmlspecialchars($_POST['retypePassword'])) {
$firebase->set(DEFAULT_PATH . "/ARCusers/$id1/password", htmlspecialchars($_POST['newPassword']));
} else {
echo "<script>alert('Passwords do not match')</script>";
}
}
} else {
header("Location:email_form");
}
?>