packages/example/front/js/reset-password.js
async function confirmResetPassword(form) {
  await client.connect();
  try {
    console.log("token : ", sessionStorage.getItem("token"));
    await api.confirmResetPassword(
      {
        token: sessionStorage.getItem("token"),
        firstPassword: form.firstPassword.value,
        secondPassword: form.secondPassword.value
      },
      "user"
    );
    displayMessage("Reset password", "Password changed", "is-success");
    goTo("login");
    sessionStorage.clear();
  } catch (e) {
    displayMessage(
      "Reset password",
      `Failed to reset the password. Cause: ${e.message}`,
      "is-danger"
    );
  }
}
async function confirmResetPassword(form) {
  await client.connect();
  try {
    console.log("token : ", sessionStorage.getItem("token"));
    await api.confirmResetPassword(
      {
        token: sessionStorage.getItem("token"),
        firstPassword: form.firstPassword.value,
        secondPassword: form.secondPassword.value
      },
      "user"
    );
    displayMessage("Reset password", "Password changed", "is-success");
    goTo("login");
    sessionStorage.clear();
  } catch (e) {
    displayMessage(
      "Reset password",
      `Failed to reset the password. Cause: ${e.message}`,
      "is-danger"
    );
  }
}
async function confirmResetPassword ( form ) { await client . connect ( ) ; try { console . log ( "token : " , sessionStorage . getItem ( "token" ) ) ; await api . confirmResetPassword ( { token : sessionStorage . getItem ( "token" ) , firstPassword : form . firstPassword . value , secondPassword : form . secondPassword . value } , "user" ) ; displayMessage ( "Reset password" , "Password changed" , "is-success" ) ; goTo ( "login" ) ; sessionStorage . clear ( ) ; } catch ( e ) { displayMessage ( "Reset password" , ` ${ e . message } ` , "is-danger" ) ; } }
Confirm reset password
Confirm reset password