Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pour desktop #67

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Backend/database.sqlite
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.
Binary file added Backend/images/6woq7y1722545966525.jpg
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/6woq7y1722546678848.jpg
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/6woq7y1723464472041.jpg
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/arknights1721553032169.png
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/better-ttv1721552319492.undefined
Binary file not shown.
Binary file added Backend/images/better-ttv1722878506074.undefined
Binary file not shown.
Binary file added Backend/images/carasect1721492092053.jpg
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/carasect1721492332850.jpg
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/carasect1721565782289.jpg
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/carasect1724313339501.jpg
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/carasect1724314234576.jpg
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/credit-card1721563541764.undefined
Binary file not shown.
Binary file added Backend/images/élajaz1721556356428.jpg
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/élajaz1721565607150.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions FrontEnd/assets/scripts/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
document.getElementById("connexion").addEventListener("submit",
async function (event) {
event.preventDefault();

const btnValidate = document.getElementById('btn-submit');
const email = document.getElementById("email").value;
const password = document.getElementById("password").value;
const errorMessage = document.getElementById('error-message'); // Récupère l'élément pour afficher les erreurs

errorMessage.textContent = ''; // Réinitialise le message d'erreur

if (!email || !password) {
alert("Veuillez remplir tous les champs.");
return; // Stoppe l'exécution si les champs ne sont pas remplis
}

btnValidate.style.backgroundColor = "#1d6154";
btnValidate.style.color = "#FFFFFF";

try {
const response = await fetch('http://localhost:5678/api/users/login', {
method: "POST",
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password })
});

if (!response.ok) {
if (response.status === 404) {
throw new Error('Utilisateur non trouvé');
} else if (response.status === 401) {
throw new Error('Mot de passe incorrect');
} else {
const errorData = await response.json();
throw new Error(errorData.message || 'Erreur lors de la connexion.');
}
} else {
const data = await response.json();
const token = data.token;
localStorage.setItem("TokenIdentification", token);

window.location.href = "./index.html";
}
} catch (error) {
errorMessage.textContent = error.message; // Affiche le message d'erreur
}
});

document.addEventListener('DOMContentLoaded', () => {
const coemail = document.getElementById('email');
const comdp = document.getElementById('password');
const cobouton = document.getElementById('btn-submit');

function validateSend() {
if (coemail.value.trim() !== '' && comdp.value.trim() !== '') {
cobouton.style.backgroundColor = "#1d6154";
cobouton.style.color = "#FFFFFF"; // Correction de la propriété 'color'
} else {
cobouton.style.backgroundColor = "#A7A7A7";
cobouton.style.color = "#000000"; // Rétablit la couleur du texte à noir lorsque désactivé
}
}

coemail.addEventListener('input', validateSend);
comdp.addEventListener('input', validateSend);
});
Loading