2025-03-28 13:53:35 +01:00
|
|
|
<register>
|
|
|
|
|
<h2>Inscription</h2>
|
|
|
|
|
<form onsubmit={registerUser}>
|
|
|
|
|
<input type="email" name="email" placeholder="Email" required>
|
|
|
|
|
<input type="password" name="password" placeholder="Mot de passe" required>
|
|
|
|
|
<button>S'inscrire</button>
|
|
|
|
|
</form>
|
|
|
|
|
<p><a href="#/login">Déjà un compte ?</a></p>
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
async registerUser(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
const email = e.target.email.value;
|
|
|
|
|
const password = e.target.password.value;
|
2025-03-28 16:27:07 +01:00
|
|
|
await window.sign(email, password);
|
2025-03-28 13:53:35 +01:00
|
|
|
window.location.href = '#';
|
|
|
|
|
},
|
|
|
|
|
onMounted() {
|
|
|
|
|
observeAuthState(user => {
|
|
|
|
|
if (user) {
|
|
|
|
|
console.log("Connecté :", user.email);
|
|
|
|
|
} else {
|
|
|
|
|
console.log("Déconnecté");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
form {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
max-width: 300px;
|
|
|
|
|
margin: auto;
|
|
|
|
|
gap: 10px;
|
|
|
|
|
margin-top: 2rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
input,
|
|
|
|
|
button {
|
|
|
|
|
padding: 0.5rem;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
button {
|
|
|
|
|
background-color: #1976d2;
|
|
|
|
|
color: white;
|
|
|
|
|
border: none;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
button:hover {
|
|
|
|
|
background-color: #135ba1;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</register>
|