From e77b509202e007f410d85de89f63a98a2643ac4f Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 20 Aug 2018 14:16:46 +0200 Subject: [PATCH] Handle already existing email account error. --- assets/js/langs/en.inc.js | 3 ++- assets/js/langs/fr.inc.js | 3 ++- assets/js/pages/createAccount.js | 9 ++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/assets/js/langs/en.inc.js b/assets/js/langs/en.inc.js index e987b3f6..16ce34b2 100644 --- a/assets/js/langs/en.inc.js +++ b/assets/js/langs/en.inc.js @@ -209,7 +209,8 @@ ComunicWeb.common.langs.en = { form_create_account_err_check_email_address: "Please check your email address !", form_create_account_err_check_password: "Please check your password !", form_create_account_err_passwd_differents: "The two passwords are not the same !", - form_create_account_err_create_account_message: "An error occured while trying to create your account. It is most likely to be a server error, or the given email address is already associated with an account.", + form_create_account_err_create_account_message: "An error occured while trying to create your account. It is most likely to be a server error, but please check your input...", + form_create_account_err_existing_email: "This email address is already associated with an account!", form_create_account_err_create_account_title: "Account creation failed", //Account created page diff --git a/assets/js/langs/fr.inc.js b/assets/js/langs/fr.inc.js index 6e54e3fd..c0d7bf08 100644 --- a/assets/js/langs/fr.inc.js +++ b/assets/js/langs/fr.inc.js @@ -208,7 +208,8 @@ ComunicWeb.common.langs.fr = { form_create_account_err_check_email_address: "Veuillez vérifier votre adresse mail !", form_create_account_err_check_password: "Veuillez vérifier votre mot de passe !", form_create_account_err_passwd_differents: "Les deux mots de passe ne sont pas identiques !", - form_create_account_err_create_account_message: "Une erreur a survenue lors de la tentative de création de compte. Ceci se produit généralement lorsque un compte associé à cette adresse mail existe déjà...", + form_create_account_err_create_account_message: "Une erreur a survenue lors de la tentative de création de compte. Veuillez vérifier votre saisie...", + form_create_account_err_existing_email: "L'adresse mail spécifiée est déjà associée à un compte...", form_create_account_err_create_account_title: "La création de compte a échouée", //Account created page diff --git a/assets/js/pages/createAccount.js b/assets/js/pages/createAccount.js index bf14fa9a..90aa4470 100644 --- a/assets/js/pages/createAccount.js +++ b/assets/js/pages/createAccount.js @@ -177,10 +177,17 @@ ComunicWeb.pages.createAccount = { //Check for error if(response.error){ + + //Determine the right error to choose + if(response.error.code == 409) + var message = "form_create_account_err_existing_email"; + else + var message = "form_create_account_err_create_account_message"; + //Display an error messagesTarget.appendChild(ComunicWeb.common.messages.createCalloutElem( lang("form_create_account_err_create_account_title"), - lang("form_create_account_err_create_account_message"), + lang(message), "danger" )); return;