|
|
@@ -39,7 +39,8 @@ class user {
|
|
|
. "" . DB_T_USER . ".id_type, "
|
|
|
. "" . DB_T_USER_TYPE . ".type "
|
|
|
. "FROM " . DB_T_USER . " "
|
|
|
- . "INNER JOIN " . DB_T_USER_TYPE . " ON " . DB_T_USER . ".id_type = " . DB_T_USER_TYPE . ".id");
|
|
|
+ . "INNER JOIN " . DB_T_USER_TYPE . " ON " . DB_T_USER . ".id_type = " . DB_T_USER_TYPE . ".id "
|
|
|
+ . "WHERE " . DB_T_USER . ".deleted = 0");
|
|
|
return db::resultset();
|
|
|
}
|
|
|
|
|
|
@@ -55,7 +56,7 @@ class user {
|
|
|
public static function connect(array $_input) {
|
|
|
$return = NULL;
|
|
|
if (isset($_input["email"]) AND isset($_input["password"])) {
|
|
|
- db::query("SELECT id, email, password, prenom, nom, id_type, googleAuthenticator, googleAuthenticatorSecret, actif FROM " . DB_T_USER . " WHERE email = :email");
|
|
|
+ db::query("SELECT id, email, password, prenom, nom, id_type, googleAuthenticator, googleAuthenticatorSecret, actif FROM " . DB_T_USER . " WHERE email = :email AND deleted = 0");
|
|
|
db::bind(':email', $_input["email"]);
|
|
|
$row = db::single();
|
|
|
|
|
|
@@ -177,9 +178,15 @@ class user {
|
|
|
}
|
|
|
|
|
|
public static function deleteUser(int $_id){
|
|
|
- db::query("DELETE FROM ". DB_T_USER ." WHERE id = :id");
|
|
|
+ db::query("UPDATE " . DB_T_USER . " SET deleted = 1 WHERE id = :id");
|
|
|
db::bind(':id', $_id);
|
|
|
- return db::execute();
|
|
|
+ try {
|
|
|
+ db::execute();
|
|
|
+ } catch (Exception $ex) {
|
|
|
+ alert::recError("Erreur lors de la suppression");
|
|
|
+ header("Location: /user-" . $_id .".html");
|
|
|
+ exit();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|