Made the option "contact admin" lives

This commit is contained in:
Pierre 2018-05-23 21:14:54 +02:00
parent 91f8edd2de
commit bde2b5dde6
6 changed files with 93 additions and 3 deletions

View File

@ -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%;
}

View File

@ -1299,6 +1299,13 @@ var ComunicWeb = {
//TODO : implement //TODO : implement
}, },
/**
* Option : send a mail to the admin
*/
mailAdmin: {
//TODO : implement
},
}, },
/** /**

View File

@ -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"
});
},
}

View File

@ -70,8 +70,21 @@ ComunicWeb.pages.passwordForgotten.main = {
//Prompt user reset option //Prompt user reset option
ComunicWeb.pages.passwordForgotten.promptOption.open(email, boxBody, function(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"));
}
}); });
}); });
}, },

View File

@ -82,7 +82,10 @@ ComunicWeb.pages.passwordForgotten.promptOption = {
appendTo: form, appendTo: form,
type: "div", type: "div",
class: "btn btn-default", class: "btn btn-default",
innerHTML: "<i class='fa fa-envelope-o'></i> Contact the administration" innerHTML: "<i class='fa fa-envelope-o'></i> Send a mail to the administration"
});
contact.addEventListener("click", function(){
callback("mail");
}); });
}, },

View File

@ -228,7 +228,8 @@ class Dev {
//Password forgotten page //Password forgotten page
"css/pages/passwordForgotten/main.css", "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/main.js",
"js/pages/passwordForgotten/promptEmail.js", "js/pages/passwordForgotten/promptEmail.js",
"js/pages/passwordForgotten/promptOption.js", "js/pages/passwordForgotten/promptOption.js",
"js/pages/passwordForgotten/mailAdmin.js",
//Logout page //Logout page
"js/pages/logout.js", "js/pages/logout.js",