mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-23 04:29:21 +00:00
Use new password input to reset password
This commit is contained in:
parent
0a6dd75a05
commit
035546d320
@ -67,6 +67,10 @@ class PasswordInput {
|
|||||||
return this._valid;
|
return this._valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get value() {
|
||||||
|
return this._input.value;
|
||||||
|
}
|
||||||
|
|
||||||
_refreshArea() {
|
_refreshArea() {
|
||||||
if (!this._ready)
|
if (!this._ready)
|
||||||
return;
|
return;
|
||||||
|
@ -104,15 +104,14 @@ ComunicWeb.pages.resetPassword.main = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Message
|
//Message
|
||||||
add_p(formTarget, "Please enter now your new password.");
|
add_p(formTarget, tr("Please enter now your new password."));
|
||||||
|
|
||||||
//Prompt for new password
|
//Prompt for new password
|
||||||
var passwordInput = createFormGroup({
|
const passwordInput = new PasswordInput(
|
||||||
target: formTarget,
|
formTarget,
|
||||||
type: "password",
|
tr("Your new password"),
|
||||||
label: "Your new password",
|
tr("Your new password")
|
||||||
placeholder: "Your new password"
|
)
|
||||||
});
|
|
||||||
|
|
||||||
//Ask password confirmation
|
//Ask password confirmation
|
||||||
var confirmPasswordInput = createFormGroup({
|
var confirmPasswordInput = createFormGroup({
|
||||||
@ -137,12 +136,12 @@ ComunicWeb.pages.resetPassword.main = {
|
|||||||
emptyElem(messagesTarget);
|
emptyElem(messagesTarget);
|
||||||
|
|
||||||
//Check password validity
|
//Check password validity
|
||||||
if(!ComunicWeb.common.formChecker.checkInput(passwordInput, true))
|
if(!passwordInput.isValid())
|
||||||
return notify("Please specify a valid password!", "danger");
|
return notify(tr("Please specify a valid password!"), "danger");
|
||||||
|
|
||||||
//Check password confirmation
|
//Check password confirmation
|
||||||
if(passwordInput.value != confirmPasswordInput.value)
|
if(passwordInput.value != confirmPasswordInput.value)
|
||||||
return notify("Password and its confirmation do not mach !", "danger");
|
return notify(tr("Password and its confirmation do not mach !"), "danger");
|
||||||
|
|
||||||
submit.style.display = "none";
|
submit.style.display = "none";
|
||||||
|
|
||||||
@ -155,8 +154,8 @@ ComunicWeb.pages.resetPassword.main = {
|
|||||||
//Check for errors
|
//Check for errors
|
||||||
if(result.error){
|
if(result.error){
|
||||||
messagesTarget.appendChild(ComunicWeb.common.messages.createCalloutElem(
|
messagesTarget.appendChild(ComunicWeb.common.messages.createCalloutElem(
|
||||||
"Error",
|
tr("Error"),
|
||||||
"The server rejected your request, please refresh the page and try again...",
|
tr("The server rejected your request, please refresh the page and try again..."),
|
||||||
"danger"
|
"danger"
|
||||||
));
|
));
|
||||||
return;
|
return;
|
||||||
@ -168,8 +167,8 @@ ComunicWeb.pages.resetPassword.main = {
|
|||||||
|
|
||||||
//Success message
|
//Success message
|
||||||
messagesTarget.appendChild(ComunicWeb.common.messages.createCalloutElem(
|
messagesTarget.appendChild(ComunicWeb.common.messages.createCalloutElem(
|
||||||
"Success",
|
tr("Success"),
|
||||||
"Your password has been successfully changed !",
|
tr("Your password has been successfully changed !"),
|
||||||
"success"
|
"success"
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -178,7 +177,7 @@ ComunicWeb.pages.resetPassword.main = {
|
|||||||
appendTo: formTarget,
|
appendTo: formTarget,
|
||||||
type: "div",
|
type: "div",
|
||||||
class: "btn btn-primary",
|
class: "btn btn-primary",
|
||||||
innerHTML: "Go login"
|
innerHTML: tr("Go login")
|
||||||
});
|
});
|
||||||
|
|
||||||
goLogin.addEventListener("click", function(e){
|
goLogin.addEventListener("click", function(e){
|
||||||
|
Loading…
Reference in New Issue
Block a user