Commit d14213e9 authored by Zohten's avatar Zohten

pseudo verification

parent 5c14292c
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<pwd-input id="password2" label="Confirmer"/> <pwd-input id="password2" label="Confirmer"/>
<error-message id="error-password" errormessage="Les mots de passe ne correspondent pas." v-show="this.showPwdError"/> <error-message id="error-password" errormessage="Les mots de passe ne correspondent pas." v-show="this.showPwdError"/>
<error-message id="error-mail" errormessage="Le mail rentré n'est pas valide" v-show="this.showMailError"/> <error-message id="error-mail" errormessage="Le mail rentré n'est pas valide" v-show="this.showMailError"/>
<error-message id="error-back" errormessage="Cet email ou ce pseudo est déjà pris." v-show="this.showBackError"/> <error-message id="error-back" errormessage="Ce pseudo est déjà pris." v-show="this.showPseudoError"/>
<error-message id="error-back" errormessage="Tous les champs obligatoires ne sont pas remplis." v-show="this.showNotFilledError"/> <error-message id="error-back" errormessage="Tous les champs obligatoires ne sont pas remplis." v-show="this.showNotFilledError"/>
</div> </div>
...@@ -38,15 +38,12 @@ export default { ...@@ -38,15 +38,12 @@ export default {
data() { data() {
return { return {
showPwdError : false, showPwdError : false,
showBackError : false,
showMailError : false, showMailError : false,
showPseudoError : false,
showNotFilledError : false, showNotFilledError : false,
} }
}, },
methods: { methods: {
updateShowBackError: function(){
this.showBackError = false; //TODO
},
onSubmit: async function(){ onSubmit: async function(){
// If we press back, we go back // If we press back, we go back
if (event.submitter.id=='back') { if (event.submitter.id=='back') {
...@@ -76,12 +73,6 @@ export default { ...@@ -76,12 +73,6 @@ export default {
return; return;
} }
// Test if Email exist/Pseudo exist
this.showBackError = false; //TODO
if (this.showBackError) {
return;
}
// Post new user if all tests are ok // Post new user if all tests are ok
if (event.submitter.id=='validate') { if (event.submitter.id=='validate') {
let request = await fetch(this.$apiRoot+'/user', let request = await fetch(this.$apiRoot+'/user',
...@@ -105,6 +96,9 @@ export default { ...@@ -105,6 +96,9 @@ export default {
let response = await request; let response = await request;
if (response.ok){ if (response.ok){
this.$router.push('lobby'); this.$router.push('lobby');
}else if(response.status==422){
// Test if Email exist/Pseudo exist
this.showPseudoError = true;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment