let formData = $(this).serialize()
$this.register(formData)
});
+
+ $(document).on("submit", '#Bastide_login_form', function (e) {
+ e.preventDefault()
+ let formData = $(this).serialize()
+ $this.login(formData)
+ });
},
addToCart: function (reference) {
<p class="title">Pour afficher les tarifs, ajouter des produits à votre sélection, et nous envoyer une demande de devis, veuillez vous identifier :</p>
<div class="form-controls">
<label for="">Adresse email</label>
- <input type="email" />
+ <input type="email" name="email" />
</div>
<div class="form-controls">
<label for="">Mot de passe</label>
- <input type="password" />
+ <input type="password" name="password" />
</div>
<button id="login" class="login cta" type="submit">S'identifier</button>
<a id="forgot-password" href="#">Mot de passe oublié ?</a>
});
},
- login: function() {
-
+ login: function(d) {
+ var $this = this
+ $.ajax({
+ url: '/fluidbook/login',
+ type: 'POST',
+ data: d,
+ success: function(data) {
+ window.reload()
+ },
+ error: function(xhr, status, error) {
+ let errorsMessage = JSON.parse(xhr.responseText);
+ $(".errors-container").remove()
+ $("#Bastide_login_form").prepend('<div class="errors-container"><p>Une erreur est survenue. Verifiez vos identifiants.</p></div>')
+ }
+ });
},
displayErrors: function(errors) {
- console.log(errors['errors'],"ok")
$(".errors-container").remove()
$(".error").removeClass("error")
for(let k in errors['errors']) {
}
},
- login: function () {
-
- },
-
getMenuWidth: function () {
return window.location.hash === '#/cart/validate' ? 990 : 1190; // Validate modal is narrower than main cart
},