$this.login(formData)
});
- $(document).on("submit", "#Bastide_forgotpass_form", function(e) {
+ $(document).on("submit", "#Bastide_forgotpass_form", function (e) {
e.preventDefault()
let formData = $(this).serialize()
$this.forgotpass(formData)
})
- $(document).on("submit", "#Bastide_resetpass_form", function(e) {
+ $(document).on("submit", "#Bastide_resetpass_form", function (e) {
e.preventDefault()
let formData = $(this).serialize()
$this.resetpass(formData)
})
- $(document).on("submit", "#Bastide_register_form,#Bastide_forgotpass_form,#Bastide_resetpass_form", function() {
+ $(document).on("submit", "#Bastide_register_form,#Bastide_forgotpass_form,#Bastide_resetpass_form", function () {
let el = $(this).find('button[type="submit"]')
$this.disabledSubmitButton(el)
})
updateDataContent: function () {
let dataContent = $("#Bastide_auth_form").find('[data-content]').data('content')
- $("#Bastide_cart").attr('data-content',dataContent)
+ $("#Bastide_cart").attr('data-content', dataContent)
},
- updateTitle: function(title = "Connexion") {
+ updateTitle: function (title = "Connexion") {
$("#mview-dialog-title").text(title)
},
return form;
},
- register: function(d) {
+ register: function (d) {
var $this = this
var token = document.cookie.match(new RegExp('(^| )XSRF-TOKEN=([^;]+)'));
token = token[0].split('=')[1]
url: '/fluidbook/signin',
type: 'POST',
data: d,
- success: function(data) {
- $this.updateTitle('Merci !')
- $this.updateCart('register_ok')
- $this.updateDataContent()
+ success: function (data) {
+ $this.updateTitle('Merci !');
+ $this.updateCart('register_ok');
+ $this.updateDataContent();
+ this.matomoPush(['trackEvent', 'register', 'send', d.email]);
},
- error: function(xhr, status, error) {
+ error: function (xhr, status, error) {
let errorsMessage = JSON.parse(xhr.responseText);
$this.displayErrors(errorsMessage)
},
- complete: function() {
+ complete: function () {
$this.disabledSubmitButton($("button[type=submit]"))
}
});
},
- login: function(d) {
+ login: function (d) {
var $this = this
$.ajax({
url: '/fluidbook/login',
type: 'POST',
data: d,
- success: function(data) {
+ success: function (data) {
window.location.reload()
},
- error: function(xhr, status, error) {
+ error: function (xhr, status, error) {
let errorsMessage = JSON.parse(xhr.responseText);
$(".errors-container").remove()
$(".error").removeClass("error")
});
},
- forgotpass: function(d) {
+ forgotpass: function (d) {
let $this = this
$.ajax({
url: '/fluidbook/forgotpassword',
type: 'POST',
data: d,
- success: function(data) {
+ success: function (data) {
$this.updateCart('forgot_pass_notif')
$this.updateDataContent()
},
- error: function(xhr, status, error) {
+ error: function (xhr, status, error) {
let errorsMessage = JSON.parse(xhr.responseText);
$this.displayErrors(errorsMessage)
},
- complete: function() {
+ complete: function () {
$this.disabledSubmitButton($("button[type=submit]"))
}
})
},
- displayErrors: function(errors) {
+ displayErrors: function (errors) {
$(".errors-container").remove()
$(".error").removeClass("error")
- for(let k in errors['errors']) {
- $("[name="+k+"]").parent().append('<div class="errors-container"></div>')
+ for (let k in errors['errors']) {
+ $("[name=" + k + "]").parent().append('<div class="errors-container"></div>')
$(".errors-container").parent().addClass("error")
- for(let i in errors['errors'][k]) {
- $("[name="+k+"]").parent().find('.errors-container').append(`<div>${errors['errors'][k][i]}</div>`)
+ for (let i in errors['errors'][k]) {
+ $("[name=" + k + "]").parent().find('.errors-container').append(`<div>${errors['errors'][k][i]}</div>`)
}
}
},
return window.location.hash === '#/cart/validate' ? 990 : 1190; // Validate modal is narrower than main cart
},
- disabledSubmitButton: function(el) {
+ disabledSubmitButton: function (el) {
$(el).toggleClass("disabled")
}