From bde2b5dde6bdcfb48fc86de2391a8470af88fa75 Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 23 May 2018 21:14:54 +0200 Subject: [PATCH] Made the option "contact admin" lives --- .../css/pages/passwordForgotten/mailAdmin.css | 18 +++++++ assets/js/common/functionsSchema.js | 7 +++ .../js/pages/passwordForgotten/mailAdmin.js | 47 +++++++++++++++++++ assets/js/pages/passwordForgotten/main.js | 15 +++++- .../pages/passwordForgotten/promptOption.js | 5 +- system/config/dev.config.php | 4 +- 6 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 assets/css/pages/passwordForgotten/mailAdmin.css create mode 100644 assets/js/pages/passwordForgotten/mailAdmin.js diff --git a/assets/css/pages/passwordForgotten/mailAdmin.css b/assets/css/pages/passwordForgotten/mailAdmin.css new file mode 100644 index 00000000..8899daea --- /dev/null +++ b/assets/css/pages/passwordForgotten/mailAdmin.css @@ -0,0 +1,18 @@ +/** + * Mail admin to reset password + * + * @author Pierre HUBERT + */ + +.reset-password-by-mail-step .title { + text-align: center; + margin-top: 0px; +} + +.reset-password-by-mail-step p { + text-align: justify; +} + +.reset-password-by-mail-step .btn-mail { + width: 100%; +} \ No newline at end of file diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index aa768738..0ba46e46 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -1299,6 +1299,13 @@ var ComunicWeb = { //TODO : implement }, + /** + * Option : send a mail to the admin + */ + mailAdmin: { + //TODO : implement + }, + }, /** diff --git a/assets/js/pages/passwordForgotten/mailAdmin.js b/assets/js/pages/passwordForgotten/mailAdmin.js new file mode 100644 index 00000000..35c60d53 --- /dev/null +++ b/assets/js/pages/passwordForgotten/mailAdmin.js @@ -0,0 +1,47 @@ +/** + * Send a mail to the administration option + * + * @author Pierre HUBERT + */ + +ComunicWeb.pages.passwordForgotten.mailAdmin = { + + /** + * Send a mail to admin + * + * @param {String} email The email address of the user + * @param {HTMLElement} target The target for the form + */ + open: function(email, target){ + + //Create container + var container = createElem2({ + appendTo: target, + type: "div", + class: "reset-password-by-mail-step" + }); + + //Add title + createElem2({ + appendTo: container, + type: "h1", + class: "title", + innerHTML: "Email us" + }); + + //Message + add_p(container, "You decided to reset your password by contacting us. " + + "Please find a way to prove us your identity in your mail, and if possible, send " + + "your email from your account email address."); + + //Add admin email address + createElem2({ + appendTo: container, + type: "a", + class: "btn btn-default btn-mail", + innerHTML: "contact@communiquons.org", + href: "mailto:contact@communiquons.org" + }); + }, + +} \ No newline at end of file diff --git a/assets/js/pages/passwordForgotten/main.js b/assets/js/pages/passwordForgotten/main.js index 8ab07e0e..da3dc174 100644 --- a/assets/js/pages/passwordForgotten/main.js +++ b/assets/js/pages/passwordForgotten/main.js @@ -70,8 +70,21 @@ ComunicWeb.pages.passwordForgotten.main = { //Prompt user reset option ComunicWeb.pages.passwordForgotten.promptOption.open(email, boxBody, function(option){ - alert(option); + //Empty body + emptyElem(boxBody); + //Open appropriate page + if(option == "mail"){ + ComunicWeb.pages.passwordForgotten.mailAdmin.open(email, boxBody); + } + + //Option not recognized + else { + boxBody.appendChild(ComunicWeb.common.messages.createCalloutElem( + "Error", + "Option not found!", + "danger")); + } }); }); }, diff --git a/assets/js/pages/passwordForgotten/promptOption.js b/assets/js/pages/passwordForgotten/promptOption.js index b489e7ce..64950e4e 100644 --- a/assets/js/pages/passwordForgotten/promptOption.js +++ b/assets/js/pages/passwordForgotten/promptOption.js @@ -82,7 +82,10 @@ ComunicWeb.pages.passwordForgotten.promptOption = { appendTo: form, type: "div", class: "btn btn-default", - innerHTML: " Contact the administration" + innerHTML: " Send a mail to the administration" + }); + contact.addEventListener("click", function(){ + callback("mail"); }); }, diff --git a/system/config/dev.config.php b/system/config/dev.config.php index 64b800b8..77b1d2d4 100644 --- a/system/config/dev.config.php +++ b/system/config/dev.config.php @@ -228,7 +228,8 @@ class Dev { //Password forgotten page "css/pages/passwordForgotten/main.css", - "css/pages/passwordForgotten/promptOption.css" + "css/pages/passwordForgotten/promptOption.css", + "css/pages/passwordForgotten/mailAdmin.css" ); /** @@ -416,6 +417,7 @@ class Dev { "js/pages/passwordForgotten/main.js", "js/pages/passwordForgotten/promptEmail.js", "js/pages/passwordForgotten/promptOption.js", + "js/pages/passwordForgotten/mailAdmin.js", //Logout page "js/pages/logout.js",