<?php namespace ajax; use Manager\DatabaseManager; header('Content-type: text/html; charset="UTF-8";'); if (count($_POST) > 0) { session_start(); include_once '../translations/label_' . $_SESSION['locale'] . '.php'; require_once '../Model/InitConsts.php'; require_once '../Manager/DatabaseManager.php'; $dm = new DatabaseManager(); $output = $dm->updateUserPassword(['password' => trim($_POST['password']), 'email' => $_POST['email']]); if (is_bool($output)) { $userDatas = $dm->fetchUser($_POST['email'], trim($_POST['password'])); if (is_array($userDatas)) { $_SESSION['customer_email'] = $userDatas['email']; $_SESSION['customer_id'] = $userDatas['id']; echo '<a href="../order">' . CONNECTION . '</a>'; } else { $errorMsg = $userDatas; } } else { $errorMsg = $output; } if (isset($errorMsg)) { echo 'e<a href="#" onclick="updatePasswd();">' . UPDATE . '</a><br><font color="red">' . $errorMsg . '</font>'; } }
header('Content-type: text/html; charset="UTF-8";'); use Manager\DatabaseManager; use Manager\UtilitiesManager; if (isset($_POST) && count($_POST) > 0) { session_start(); include_once '../translations/label_' . (isset($_SESSION['locale']) ? $_SESSION['locale'] : 'fr') . '.php'; require_once '../Model/InitConsts.php'; require_once '../Manager/UtilitiesManager.php'; $a_cleaned_values = UtilitiesManager::checkEmptyDatasPost($_POST); if (is_array($a_cleaned_values)) { if (FALSE !== stripos($a_cleaned_values['email'], '@') && FALSE !== stripos($a_cleaned_values['email'], '.')) { require_once '../Model/InitConsts.php'; require_once '../Manager/DatabaseManager.php'; $mm = new DatabaseManager(); $output = $mm->fetchUser($a_cleaned_values['email']); if (is_bool($output)) { if ($output) { echo '<br><input type="password" name="password" placeholder="' . PASSWD . ' 6 ' . CHARS . '">'; echo '<br><br><a href="#" onclick="document.getElementById(\'the_form\').submit();">' . CONNECTION . '</a>'; } else { echo '<input type="hidden" name="first_login" value="true">'; echo '<br><input type="password" name="psk" placeholder="' . PSK . '">'; echo '<br><input type="password" name="new_password" placeholder="' . PASSWD . ' 6 ' . CHARS . '">'; echo '<br><br><a href="#" onclick="document.getElementById(\'the_form\').submit();">' . CONNECTION . '</a>'; } } else { echo 'e<font color="red">' . $output . '</font>'; } } } else {
if (isset($_SESSION['customer_email']) && !empty($_SESSION['customer_email'])) { header('Location: ../'); } if (isset($_GET['do']) && trim($_GET['do']) === 'logout') { //logout unset($_SESSION['customer_email']); unset($_SESSION['customer_id']); } if (count($_POST) > 0) { require_once '../Model/InitConsts.php'; require_once '../Manager/UtilitiesManager.php'; $a_cleaned_values = UtilitiesManager::checkEmptyDatasPost($_POST); if (is_array($a_cleaned_values)) { require_once '../Manager/DatabaseManager.php'; $dm = new DatabaseManager(); $output = $dm->fetchUser($a_cleaned_values['email'], $a_cleaned_values['password']); if (is_array($output)) { if ($output['password'] !== InitConsts::HASH_PASSWD) { $_SESSION['customer_email'] = $output['email']; $_SESSION['customer_id'] = $output['id']; header('Location: ../'); } else { $errorMsg = WRONG_LOGIN_PAGE . ' <a href="../firstLogin">login</a>'; } //if user try to login with PSK as password in classic login page } else { $errorMsg = $output; } } else { $errorMsg = INPUTS_MANDATORIES; }
namespace ajax; use Manager\DatabaseManager; use Manager\MailManager; use Model\InitConsts; header('Content-type: text/html; charset="UTF-8";'); if (count($_POST) > 0) { $rescueEmail = trim($_POST['email_rescue']); if (strlen($rescueEmail) > 5) { session_start(); include_once '../translations/label_' . $_SESSION['locale'] . '.php'; require_once '../Model/InitConsts.php'; require_once '../Manager/DatabaseManager.php'; $dm = new DatabaseManager(); $outputdm = $dm->fetchUser($rescueEmail); if (is_bool($outputdm)) { //using redis to store temporary hash and email info $hash = sha1(microtime(TRUE)); $redis = new \Redis(); $redis->connect('127.0.0.1'); $redis->set($rescueEmail, $hash, 60 * 60); require_once '../Manager/MailManager.php'; $resetLink = 'http://tampoon.net/resetPassword/?email=' . $rescueEmail . '&hash=' . $hash; $msg = '<html><body><br><a href="' . $resetLink . '">' . CLICK_TO_RESET_PASSWD . '</a>'; $msg .= '<br>' . COPY_RESET_PASSWD_URL; $msg .= '<br>' . $resetLink; $msg .= '<br><font color="red>"' . AVAILABLE_24H . '</font>'; $msg .= '</body></html>'; $mm = new MailManager($rescueEmail, InitConsts::GMAIL_BOX, RESET_PASSWORD, $msg); $outputmm = $mm->send();