Esempio n. 1
0
 function resetpassword()
 {
     $userId = Users::getUserIdByCode($_POST["txtCode"]);
     if ($userId != -1) {
         $date = Users::getCodeDate($_POST["txtCode"]);
         $date = strtotime($date) + 600;
         if (strtotime(date("Y-m-d H:i:s")) <= $date) {
             if ($_POST["txtPassword"] == $_POST["txtPasswordConfirm"]) {
                 $salt = Registration::generateSalt();
                 $crypt = crypt($_POST["txtPassword"], $salt);
                 Users::updatePassword($userId, $crypt, $salt);
                 Users::deleteCode($userId);
                 header(CONNECTION_HEADER);
             }
         } else {
             Users::deleteCode($userId);
             $data = array("Forgot" => true);
             $this->renderTemplate(file_get_contents(RESET_PAGE), $data);
         }
     } else {
         Users::deleteCode($userId);
         $data = array("Forgot" => true);
         $this->renderTemplate(file_get_contents(RESET_PAGE), $data);
     }
 }
Esempio n. 2
0
 /**
  * Éditer un administrateur de patrimoine
  *
  * TODO: Message d'erreur si l'opération échoue (transmis par un callback au client qui a envoyé la requête)
  */
 function editFamilyAdmin()
 {
     if (isset($_POST["UserId"])) {
         if (isset($_POST["UserName"])) {
             Users::updateUserName($_POST["UserId"], $_POST["UserName"]);
         }
         if (isset($_POST["UserInfoFirstName"])) {
             Users::updateFirstName($_POST["UserId"], $_POST["UserInfoFirstName"]);
         }
         if (isset($_POST["UserInfoLastName"])) {
             Users::updateLastName($_POST["UserId"], $_POST["UserInfoLastName"]);
         }
         if (isset($_POST["UserInfoTel"])) {
             $phone = Registration::normalizePhoneNumber($_POST["UserInfoTel"]);
             Users::updateTel($_POST["UserId"], $phone);
         }
         if (isset($_POST["UserPass"])) {
             if (!empty($_POST["UserPass"])) {
                 $salt = Registration::generateSalt();
                 $crypt = crypt($_POST["UserPass"], $salt);
                 Users::updatePassword($_POST["UserId"], $crypt, $salt);
             }
         }
     }
 }