AJout des confirm sur les vue JS dans le BO + Ajout de la commande qui supprime les utilisateurs au bout de 24 heures sans confirmation d'email

This commit is contained in:
Romain Bonhomme 2020-11-23 12:52:32 +01:00
parent 63cd51e8c7
commit df31b4809f
12 changed files with 179 additions and 104268 deletions

View file

@ -0,0 +1,46 @@
<?php
namespace App\Console\Commands;
use App\User;
use Carbon\Carbon;
use Illuminate\Console\Command;
class DeleteNotConfirmedUser extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'users:deletenc';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Remove users who have not confirmed their accounts within 24 hours of registration';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$users = User::where([['email_verified', 0], ['created_at', '<', Carbon::now()->subDay()]])->get();
foreach ($users as $user)
$user->delete();
}
}

10989
public/css/app.css vendored

File diff suppressed because one or more lines are too long

93145
public/js/app.js vendored

File diff suppressed because one or more lines are too long

View file

@ -119,20 +119,22 @@
},
// Supprime une ligne dans la base si elle existait déjà
removeItem(ip) {
let i = this.baseDatas.findIndex(element => element.ip == ip);
let iDatas = this.datas.findIndex(element => element.ip == ip);
if (i !== null && this.baseDatas[i]['ip'] !== null) {
axios.post('/bo/ajax/delete-banned-ip', {
ip: this.baseDatas[i]['ip'],
})
.catch(function (error) {
console.log(error);
});
this.baseDatas.splice(i, 1);
this.datas.splice(iDatas, 1);
} else {
this.baseDatas.splice(i, 1);
this.datas.splice(iDatas, 1);
if (confirm("Êtes-vous sûr(e) ?")) {
let i = this.baseDatas.findIndex(element => element.ip == ip);
let iDatas = this.datas.findIndex(element => element.ip == ip);
if (i !== null && this.baseDatas[i]['ip'] !== null) {
axios.post('/bo/ajax/delete-banned-ip', {
ip: this.baseDatas[i]['ip'],
})
.catch(function (error) {
console.log(error);
});
this.baseDatas.splice(i, 1);
this.datas.splice(iDatas, 1);
} else {
this.baseDatas.splice(i, 1);
this.datas.splice(iDatas, 1);
}
}
},
// Sauvegarde les données dans la base

View file

@ -121,20 +121,22 @@
},
// Supprime une ligne dans la base si elle existait déjà
removeItem(id) {
let i = this.baseDatas.findIndex(element => element.id == id);
let iDatas = this.datas.findIndex(element => element.id == id);
if (i !== null && this.baseDatas[i]['id'] !== null) {
axios.post('/bo/ajax/delete-codes-ean', {
id: this.baseDatas[i]['id'],
})
.catch(function (error) {
console.log(error);
});
this.baseDatas.splice(i, 1);
this.datas.splice(iDatas, 1);
} else {
this.baseDatas.splice(i, 1);
this.datas.splice(iDatas, 1);
if (confirm("Êtes-vous sûr(e) ?")) {
let i = this.baseDatas.findIndex(element => element.id == id);
let iDatas = this.datas.findIndex(element => element.id == id);
if (i !== null && this.baseDatas[i]['id'] !== null) {
axios.post('/bo/ajax/delete-codes-ean', {
id: this.baseDatas[i]['id'],
})
.catch(function (error) {
console.log(error);
});
this.baseDatas.splice(i, 1);
this.datas.splice(iDatas, 1);
} else {
this.baseDatas.splice(i, 1);
this.datas.splice(iDatas, 1);
}
}
},
// Sauvegarde les données dans la base

View file

@ -1,23 +0,0 @@
<template>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Example Component</div>
<div class="card-body">
I'm an example component.
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>

View file

@ -94,25 +94,27 @@
this.datas.push({id: null, question: '', answer: '', positive_vote: 0, negative_vote: 0, theme_id: null, toggle: false});
},
removeItem(index) {
if (this.datas[index]['id'] !== null) {
this.processing = true;
this.response = "Suppression en cours...";
axios.post('/bo/ajax/delete-faq-question', {
id: this.datas[index]['id'],
}).then(
(response) => {
this.response = "Suppression terminée !";
if (confirm("Êtes-vous sûr(e) ?")) {
if (this.datas[index]['id'] !== null) {
this.processing = true;
this.response = "Suppression en cours...";
axios.post('/bo/ajax/delete-faq-question', {
id: this.datas[index]['id'],
}).then(
(response) => {
this.response = "Suppression terminée !";
this.processing = false;
}
)
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la suppression.";
this.processing = false;
}
)
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la suppression.";
this.processing = false;
});
this.datas.splice(index, 1);
} else {
this.datas.splice(index, 1);
});
this.datas.splice(index, 1);
} else {
this.datas.splice(index, 1);
}
}
},
saveData() {

View file

@ -80,38 +80,40 @@
this.datas.push({id: null, name: ''});
},
removeItem(index) {
if (this.datas[index]['id'] !== null) {
this.processing = true;
this.response = "Suppression en cours...";
axios.post('/bo/ajax/delete-faq-theme', {
id: this.datas[index]['id'],
}).then(
(response) => {
let result = response.data;
switch (result) {
case 0: case 2:
// 0 = Supprimé, 2 = Pas encore en base, supprimer juste dans la vue
this.response = "Suppression terminée !";
this.datas.splice(index, 1);
this.processing = false;
break;
case 1:
// 1 = Non supprimer car des questions lui sont lié
this.response = "Erreur : des questions sont encore liées à ce thème.";
setTimeout(function() {
if (confirm("Êtes-vous sûr(e) ?")) {
if (this.datas[index]['id'] !== null) {
this.processing = true;
this.response = "Suppression en cours...";
axios.post('/bo/ajax/delete-faq-theme', {
id: this.datas[index]['id'],
}).then(
(response) => {
let result = response.data;
switch (result) {
case 0: case 2:
// 0 = Supprimé, 2 = Pas encore en base, supprimer juste dans la vue
this.response = "Suppression terminée !";
this.datas.splice(index, 1);
this.processing = false;
}.bind(this), 1500);
break;
break;
case 1:
// 1 = Non supprimer car des questions lui sont lié
this.response = "Erreur : des questions sont encore liées à ce thème.";
setTimeout(function() {
this.processing = false;
}.bind(this), 1500);
break;
}
}
}
)
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la suppression.";
this.processing = false;
});
} else {
this.datas.splice(index, 1);
)
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la suppression.";
this.processing = false;
});
} else {
this.datas.splice(index, 1);
}
}
},
saveData() {

View file

@ -62,24 +62,26 @@
this.datas.push({name: '', file_name: ''});
},
removeItem(index) {
if (this.datas[index]['id'] !== undefined) {
this.processing = true;
this.response = "Suppression en cours...";
axios.post('/bo/ajax/delete-gain-views', {
id: this.datas[index]['id'],
}).then(
response => (this.response = response.data)
)
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la suppression.";
});
this.datas.splice(index, 1);
setTimeout(function() {
this.processing = false;
}.bind(this), 3000);
} else {
this.datas.splice(index, 1);
if (confirm("Êtes-vous sûr(e) ?")) {
if (this.datas[index]['id'] !== undefined) {
this.processing = true;
this.response = "Suppression en cours...";
axios.post('/bo/ajax/delete-gain-views', {
id: this.datas[index]['id'],
}).then(
response => (this.response = response.data)
)
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la suppression.";
});
this.datas.splice(index, 1);
setTimeout(function() {
this.processing = false;
}.bind(this), 3000);
} else {
this.datas.splice(index, 1);
}
}
},
saveData() {

View file

@ -176,24 +176,26 @@
});
},
removeItem(index) {
if (this.datas[index]['id'] !== undefined) {
this.processing = true;
this.response = "Suppression en cours...";
axios.post('/bo/ajax/delete-prize', {
id: this.datas[index]['id'],
}).then(
response => (this.response = response.data)
)
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la suppression.";
});
this.datas.splice(index, 1);
setTimeout(function() {
this.processing = false;
}.bind(this), 3000);
} else {
this.datas.splice(index, 1);
if (confirm("Êtes-vous sûr(e) ?")) {
if (this.datas[index]['id'] !== undefined) {
this.processing = true;
this.response = "Suppression en cours...";
axios.post('/bo/ajax/delete-prize', {
id: this.datas[index]['id'],
}).then(
response => (this.response = response.data)
)
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la suppression.";
});
this.datas.splice(index, 1);
setTimeout(function() {
this.processing = false;
}.bind(this), 3000);
} else {
this.datas.splice(index, 1);
}
}
},
saveData() {

View file

@ -58,7 +58,9 @@
this.datas.push({web_coupon_identifiant: '', percentage: 0, face_value: 0, valid_on: '', img_name: ''});
},
removeItem(index) {
this.datas.splice(index, 1);
if (confirm("Êtes-vous sûr(e) ?")) {
this.datas.splice(index, 1);
}
}
},
computed: {

View file

@ -52,7 +52,9 @@
this.datas.push({email: ''});
},
removeItem(index) {
this.datas.splice(index, 1);
if (confirm("Êtes-vous sûr(e) ?")) {
this.datas.splice(index, 1);
}
}
}
}