-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from HE-Arc/dev
Dev
- Loading branch information
Showing
8 changed files
with
140 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ const form = ref(null) | |
const username = ref(null) | ||
const password = ref(null) | ||
const errorMessage = ref(null) | ||
const login = () => { | ||
if (!form.value.reportValidity()) return; | ||
|
@@ -16,7 +17,9 @@ const login = () => { | |
password.value, | ||
).then((token) => { | ||
router.push({ name: "home" }) | ||
}) | ||
}).catch(error => { | ||
errorMessage.value = "Nom d'utilisateur ou mot de passe incorrect"; // Définition du message d'erreur | ||
}); | ||
}; | ||
</script> | ||
|
@@ -29,7 +32,7 @@ const login = () => { | |
<form method="post" ref="form"> | ||
<div class="form-row"> | ||
<label for="username">Pseudo :</label> | ||
<input id="username" type="text" name="username" placeholder="[email protected]" | ||
<input id="username" type="text" name="username" | ||
v-model="username" required> | ||
</div> | ||
<div class="form-row"> | ||
|
@@ -39,12 +42,16 @@ const login = () => { | |
</form> | ||
<button class="btn-primary" @click="login">Connexion</button> | ||
<hr> | ||
<div v-if="errorMessage" class="error-message">{{ errorMessage }}</div> | ||
<p>Pas de compte ? <router-link :to="{ name: 'register' }">S'inscrire</router-link></p> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
@import "@/assets/styles/breakpoints"; | ||
@import "@/assets/styles/colors"; | ||
.flex-container { | ||
align-items: center; | ||
justify-content: center; | ||
|
@@ -87,5 +94,12 @@ const login = () => { | |
} | ||
} | ||
} | ||
.error-message { | ||
background-color: $primary; | ||
color: $on-primary; | ||
text-align: center; | ||
padding: 12px 16px; | ||
border-radius: 8px; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ const register = async () => { | |
<form method="post" ref="form"> | ||
<div class="form-row"> | ||
<label for="username">Pseudo :</label> | ||
<input id="username" type="text" name="username" placeholder="[email protected]" | ||
<input id="username" type="text" name="username" | ||
v-model="username" required> | ||
</div> | ||
<div class="form-row"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters