Commit 8ab5e523 authored by Zohten's avatar Zohten

added email check

parent 8c94ae59
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<pwd-input id="password1" label="Mot de passe"/> <pwd-input id="password1" label="Mot de passe"/>
<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-back" errormessage="Cet email ou ce pseudo est déjà pris." v-show="this.showBackError"/> <error-message id="error-back" errormessage="Cet email ou ce pseudo est déjà pris." v-show="this.showBackError"/>
...@@ -37,13 +38,10 @@ export default { ...@@ -37,13 +38,10 @@ export default {
return { return {
showPwdError : false, showPwdError : false,
showBackError : false, showBackError : false,
showMailError : false,
} }
}, },
methods: { methods: {
updateShowPwdError: function(){
this.showPwdError = (document.getElementById('password1').value !== document.getElementById('password2').value);
},
updateShowBackError: function(){ updateShowBackError: function(){
this.showBackError = false; //TODO this.showBackError = false; //TODO
}, },
...@@ -52,6 +50,10 @@ export default { ...@@ -52,6 +50,10 @@ export default {
if (this.showPwdError) { if (this.showPwdError) {
return; return;
} }
this.showMailError = !validateEmail(document.getElementById('mail').value);
if (this.showMailError) {
return;
}
this.showBackError = false; //TODO this.showBackError = false; //TODO
if (this.showBackError) { if (this.showBackError) {
return; return;
...@@ -84,6 +86,10 @@ export default { ...@@ -84,6 +86,10 @@ export default {
} }
} }
} }
function validateEmail (email) {
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return re.test(String(email).toLowerCase());
}
</script> </script>
<style> <style>
......
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