Skip to content

Commit

Permalink
Merge pull request #1 from meriemno/meriemno-patch-1
Browse files Browse the repository at this point in the history
Meriemno patch 1
  • Loading branch information
meriemno authored Mar 9, 2024
2 parents 56bd6dd + 9c95052 commit 76a838d
Show file tree
Hide file tree
Showing 97 changed files with 1,266 additions and 80 deletions.
Binary file modified Backend/database.sqlite
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/images/Ohmyfood1708979757241.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/images/Ohmyfood1709498197127.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/images/Ohmyfood1709499125449.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added Backend/images/abajour-tahina1708963552556.png
Binary file added Backend/images/abajour-tahina1708963685317.png
Binary file added Backend/images/abajour-tahina1709499354543.png
Binary file added Backend/images/abajour-tahina1709500828515.png
Binary file added Backend/images/abajour-tahina1709501252229.png
Binary file added Backend/images/abajour-tahina1709501623798.png
Binary file added Backend/images/abajour-tahina1709501850973.png
Binary file added Backend/images/abajour-tahina1709502929418.png
Binary file added Backend/images/abajour-tahina1709503059776.png
Binary file added Backend/images/abajour-tahina1709503099674.png
Binary file added Backend/images/abajour-tahina1709503189922.png
Binary file added Backend/images/bar-lullaby-paris1708963665632.png
Binary file added Backend/images/bar-lullaby-paris1708963728327.png
Binary file added Backend/images/bar-lullaby-paris1709499305172.png
Binary file added Backend/images/la-balisiere1708963798008.png
Binary file added Backend/images/la-balisiere1709499369952.png
Binary file added Backend/images/la-balisiere1709500879174.png
Binary file added Backend/images/la-balisiere1709501245756.png
Binary file added Backend/images/la-balisiere1709501865919.png
Binary file added Backend/images/la-balisiere1709502747310.png
Binary file added Backend/images/la-balisiere1709502805265.png
Binary file added Backend/images/la-balisiere1709503705323.png
Binary file added Backend/images/la-balisiere1709673649251.png
Binary file added Backend/images/la-balisiere1709673669173.png
Binary file added Backend/images/la-balisiere1709673947177.png
Binary file added Backend/images/la-balisiere1709673983979.png
Binary file added Backend/images/la-balisiere1709673987773.png
Binary file added Backend/images/la-balisiere1709674089343.png
Binary file added Backend/images/la-balisiere1709674174587.png
Binary file added Backend/images/le-coteau-cassis1709499362801.png
Binary file added Backend/images/le-coteau-cassis1709500766511.png
Binary file added Backend/images/le-coteau-cassis1709501695660.png
Binary file added Backend/images/le-coteau-cassis1709502155511.png
Binary file added Backend/images/le-coteau-cassis1709502792986.png
3 changes: 3 additions & 0 deletions FrontEnd/assets/icons/picture.svg
Binary file added FrontEnd/assets/images/abajour-tahina.gif
100 changes: 100 additions & 0 deletions FrontEnd/assets/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
const emailUser = document.querySelector('#email');
const passwordUser = document.querySelector('#password');
const formulaire = document.querySelector('form');
const message = document.querySelector('form .erreur');
const loged = window.localStorage.loged;




async function validateForm() {
formulaire.addEventListener('submit', async (event) => {


event.preventDefault();
//declarer les variables et recuperer la saisi
let email = emailUser.value;
let password = passwordUser.value;
//affichage console

if (!email || !password) {
// Gérer l'erreur de validation, par exemple, afficher un message à l'utilisateur
console.log('Veuillez remplir tous les champs obligatoires.');
message.textContent = 'Veuillez remplir tous les champs obligatoires.';
return;
}


try {
//fetch post

const response = await fetch('http://localhost:5678/api/users/login', {

method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: email,
password: password
})
})
if (!response.ok) {
console.log(response.status, 'Unauthorized');
throw new Error('Non autorisé (Unauthorized). Veuillez vous connecter.', response.status);
}

const data = await response.json();
console.log(data);



if (data.token) {
console.log(data.token);
//redirection vers la page d'accueil en mode creation
window.sessionStorage.loged = true;
window.sessionStorage.accessToken = data.token;
console.log(data.token);
window.location.href = 'index.html';
console.log(window.sessionStorage.loged);


} else {

message.textContent = 'Erreur dans l’identifiant ou le mot de passe';
message.style.color = 'red';
window.localStorage.removeItem('token');
window.sessionStorage.removeItem('token');

}
} catch (error) {
// console.log('Error:', error.name, 'Message:', error.message);
if (error instanceof TypeError) {
// La requête a échoué car le service n'est pas joignable
console.log('Le service n\'est pas joignable. Veuillez réessayer plus tard.');
message.textContent = 'Le service n\'est pas joignable. Veuillez réessayer plus tard.'

} else {
// Une autre erreur s'est produite
console.log('Une erreur inattendue s\'est produite:', error);
message.textContent = 'Une erreur inattendue s\'est produite.'


}

}


})

}


function init() {

validateForm();

}

init();
Loading

0 comments on commit 76a838d

Please sign in to comment.