Example #1
0
 */
require_once 'includes/galette.inc.php';
// initialize warnings
$hash = '';
$password_updated = false;
$password = new Galette\Core\Password();
// get hash id, $_GET if passed by url, $_POST if passed by this form
if (isset($_GET['hash']) && !empty($_GET['hash'])) {
    $hash = $_GET['hash'];
} else {
    if (isset($_POST['hash']) && !empty($_POST['hash'])) {
        $hash = $_POST['hash'];
    }
}
if (isset($hash) && !empty($hash)) {
    if ($id_adh = $password->isHashValid($hash)) {
        // Validation
        if (isset($_POST['valid']) && $_POST['valid'] == '1') {
            if ($_POST['mdp_adh'] == '') {
                $error_detected[] = _T("No password");
            } else {
                if (isset($_POST['mdp_adh2'])) {
                    if (strcmp($_POST['mdp_adh'], $_POST['mdp_adh2'])) {
                        $error_detected[] = _T("- The passwords don't match!");
                    } else {
                        if (strlen($_POST['mdp_adh']) < 4) {
                            $error_detected[] = _T("- The password must be of at least 4 characters!");
                        } else {
                            $res = Galette\Entity\Adherent::updatePassword($id_adh, $_POST['mdp_adh']);
                            if ($res !== true) {
                                $error_detected[] = _T("An error occured while updating your password.");