コード例 #1
0
ファイル: Membre.php プロジェクト: Piou-piou/ribs-framwork
 /**
  * @param string $old_mdp
  * @param string $new_mdp
  * @param string $verif_new_mdp
  */
 public function setMdp($old_mdp, $new_mdp, $verif_new_mdp)
 {
     $dbc = \core\App::getDb();
     $mdp = Encrypt::setDecryptMdp($this->mdp, $this->id_identite);
     //si mdp trop court
     if (md5($old_mdp) != $mdp) {
         $err = "Votre mot de passe est incorrect";
         $this->erreur = $err;
     } else {
         if ($new_mdp != $verif_new_mdp) {
             $err = "Vos mots de passe sont différents";
             $this->erreur = $err;
         } else {
             $mdpok = Encrypt::setEncryptMdp($new_mdp, $this->id_identite);
             //le nouveau mdp est bon on update
             $dbc->update("mdp", $mdpok)->from("identite")->where("ID_identite", "=", $this->id_identite)->set();
             $this->mdp = $mdpok;
         }
     }
 }