{"id":22956,"date":"2026-05-15T09:54:48","date_gmt":"2026-05-15T09:54:48","guid":{"rendered":"https:\/\/www.salvatorerobuschi.com\/reserved-area\/modifica-password\/"},"modified":"2026-06-05T07:35:10","modified_gmt":"2026-06-05T07:35:10","slug":"change-password","status":"publish","type":"page","link":"https:\/\/www.salvatorerobuschi.com\/en\/reserved-area\/change-password\/","title":{"rendered":"Change password"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"22956\" class=\"elementor elementor-22956 elementor-22674\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-ed182bc e-con-full e-flex e-con e-parent\" data-id=\"ed182bc\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-21afe01 elementor-widget__width-initial elementor-widget-mobile__width-inherit elementor-widget elementor-widget-heading\" data-id=\"21afe01\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h1 class=\"elementor-heading-title elementor-size-default\">Want to change your <span style=\"color: #e4002b\">password?<\/span><\/h1>\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-7461ec7 e-con-full e-flex e-con e-child\" data-id=\"7461ec7\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t<div class=\"elementor-element elementor-element-32f4123 e-con-full e-flex e-con e-child\" data-id=\"32f4123\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-b95f8fc elementor-button-align-start elementor-mobile-button-align-start elementor-widget elementor-widget-form\" data-id=\"b95f8fc\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;step_next_label&quot;:&quot;Next&quot;,&quot;step_previous_label&quot;:&quot;Previous&quot;,&quot;step_type&quot;:&quot;none&quot;,&quot;step_icon_shape&quot;:&quot;circle&quot;}\" data-widget_type=\"form.default\">\n\t\t\t\t\t\t\t<form class=\"elementor-form\" method=\"post\" id=\"custom_password_reset_form\" name=\"Modifica password\" aria-label=\"Modifica password\">\n\t\t\t<input type=\"hidden\" name=\"post_id\" value=\"22956\"\/>\n\t\t\t<input type=\"hidden\" name=\"form_id\" value=\"b95f8fc\"\/>\n\t\t\t<input type=\"hidden\" name=\"referer_title\" value=\"Change password reserved area | Salvatore Robuschi\" \/>\n\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"queried_id\" value=\"22956\"\/>\n\t\t\t\n\t\t\t<div class=\"elementor-form-fields-wrapper elementor-labels-above\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-type-password elementor-field-group elementor-column elementor-field-group-current_password elementor-col-100\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input size=\"1\" type=\"password\" name=\"form_fields[current_password]\" id=\"form-field-current_password\" class=\"elementor-field elementor-size-md  elementor-field-textual\" placeholder=\"Current password *\">\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-type-password elementor-field-group elementor-column elementor-field-group-new_password elementor-col-100\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input size=\"1\" type=\"password\" name=\"form_fields[new_password]\" id=\"form-field-new_password\" class=\"elementor-field elementor-size-md  elementor-field-textual\" placeholder=\"New password *\">\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-type-password elementor-field-group elementor-column elementor-field-group-new_password_confirm elementor-col-100\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input size=\"1\" type=\"password\" name=\"form_fields[new_password_confirm]\" id=\"form-field-new_password_confirm\" class=\"elementor-field elementor-size-md  elementor-field-textual\" placeholder=\"Confirm new password *\">\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-type-text elementor-field-group elementor-column elementor-field-group-secretquestion elementor-col-100\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input size=\"1\" type=\"text\" name=\"form_fields[secretquestion]\" id=\"form-field-secretquestion\" class=\"elementor-field elementor-size-md  elementor-field-textual\" placeholder=\"New security question *\">\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-type-text elementor-field-group elementor-column elementor-field-group-secretanswer elementor-col-100\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input size=\"1\" type=\"text\" name=\"form_fields[secretanswer]\" id=\"form-field-secretanswer\" class=\"elementor-field elementor-size-md  elementor-field-textual\" placeholder=\"New security answer *\">\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-field-group elementor-column elementor-field-type-submit elementor-col-100 e-form__buttons\">\n\t\t\t\t\t<button class=\"elementor-button elementor-size-sm\" type=\"submit\" id=\"edit-password\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Change<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/button>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/form>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4688280 elementor-hidden-tablet elementor-hidden-mobile elementor-widget elementor-widget-text-editor\" data-id=\"4688280\" data-element_type=\"widget\" data-e-type=\"widget\" id=\"error-unfilled\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>All fields are required<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3eadbff elementor-widget elementor-widget-text-editor\" data-id=\"3eadbff\" data-element_type=\"widget\" data-e-type=\"widget\" id=\"error-mismatch\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Passwords do not match<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0dd37c6 elementor-widget elementor-widget-text-editor\" data-id=\"0dd37c6\" data-element_type=\"widget\" data-e-type=\"widget\" id=\"error-wrong-password\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Incorrect current password<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5477cac elementor-widget elementor-widget-text-editor\" data-id=\"5477cac\" data-element_type=\"widget\" data-e-type=\"widget\" id=\"success-text\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Password changed successfully<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-aadbc88 elementor-hidden-desktop elementor-hidden-tablet elementor-hidden-mobile elementor-widget elementor-widget-shortcode\" data-id=\"aadbc88\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\"><script>\r\ndocument.addEventListener(\"DOMContentLoaded\", function() {\r\n    const form = document.getElementById('custom_password_reset_form');\r\n    \r\n    \/\/ Grab the Elementor text widgets by their IDs\r\n    const errorUnfilled = document.getElementById('error-unfilled');\r\n    const errorMismatch = document.getElementById('error-mismatch');\r\n    const errorWrongPassword = document.getElementById('error-wrong-password');\r\n    const successText = document.getElementById('success-text');\r\n\r\n    \/\/ Helper function to hide all messages\r\n    function hideAllMessages() {\r\n        if (errorUnfilled) errorUnfilled.style.display = 'none';\r\n        if (errorMismatch) errorMismatch.style.display = 'none';\r\n        if (errorWrongPassword) errorWrongPassword.style.display = 'none';\r\n        if (successText) successText.style.display = 'none';\r\n    }\r\n\r\n    \/\/ Hide all messages immediately when the page loads\r\n    hideAllMessages();\r\n\r\n    \/\/ Safety check to avoid \"null\" eventListener errors\r\n    if (!form) return; \r\n\r\n    form.addEventListener('submit', async function(event) {\r\n        \/\/ Prevent the default Elementor form submission\r\n        event.preventDefault();\r\n        \r\n        \/\/ Hide any previously shown messages on new submission attempt\r\n        hideAllMessages();\r\n\r\n        \/\/ 1. Get field values\r\n        const oldPassword = document.getElementById('form-field-current_password').value;\r\n        const newPassword = document.getElementById('form-field-new_password').value;\r\n        const confirmPassword = document.getElementById('form-field-new_password_confirm').value;\r\n        \r\n        const secretQuestion = document.getElementById('form-field-secretquestion').value;\r\n        const secretAnswer = document.getElementById('form-field-secretanswer').value;\r\n\r\n        \/\/ Check which sections the user is trying to update\r\n        const isUpdatingPassword = oldPassword || newPassword || confirmPassword;\r\n        const isUpdatingSecurity = secretQuestion || secretAnswer;\r\n\r\n        \/\/ 2. FE Validation\r\n        if (!isUpdatingPassword && !isUpdatingSecurity) {\r\n            if (errorUnfilled) errorUnfilled.style.display = 'block';\r\n            return;\r\n        }\r\n\r\n        if (isUpdatingPassword) {\r\n            if (!oldPassword || !newPassword || !confirmPassword) {\r\n                if (errorUnfilled) errorUnfilled.style.display = 'block';\r\n                return;\r\n            }\r\n            if (newPassword !== confirmPassword) {\r\n                if (errorMismatch) errorMismatch.style.display = 'block';\r\n                return;\r\n            }\r\n        }\r\n\r\n        if (isUpdatingSecurity) {\r\n            if (!secretQuestion || !secretAnswer) {\r\n                if (errorUnfilled) errorUnfilled.style.display = 'block';\r\n                return;\r\n            }\r\n        }\r\n\r\n        \/\/ 3. Prepare Authentication Headers\r\n        \/\/ Check both 'mnemosyne_jwt' (from your old script) and 'token' (from the new login script)\r\n        const token = localStorage.getItem('mnemosyne_jwt') || localStorage.getItem('token') || sessionStorage.getItem('token'); \r\n        \r\n        if (!token) {\r\n            alert(\"Errore di autenticazione. Effettua nuovamente l'accesso.\"); \r\n            return;\r\n        }\r\n\r\n        const headers = {\r\n            'Content-Type': 'application\/json',\r\n            'Authorization': `${token}`\r\n        };\r\n\r\n        try {\r\n            \/\/ Update button text to show loading state\r\n            const submitBtnText = document.querySelector('#edit-password .elementor-button-text');\r\n            const originalText = submitBtnText ? submitBtnText.innerText : 'Modifica';\r\n            if (submitBtnText) submitBtnText.innerText = 'Attendere...'; \r\n\r\n            let passwordSuccess = true;\r\n            let securitySuccess = true;\r\n            let wrongOldPassword = false;\r\n\r\n            \/\/ 4. Send PUT request for Password (if fields are filled)\r\n            if (isUpdatingPassword) {\r\n                const pwResponse = await fetch('https:\/\/drawings.salvatorerobuschi.com\/user\/profile\/password', {\r\n                    method: 'PUT',\r\n                    headers: headers,\r\n                    body: JSON.stringify({ \r\n                        oldPassword: oldPassword, \r\n                        newPassword: newPassword \r\n                    })\r\n                });\r\n\r\n                if (pwResponse.status === 400) {\r\n                    wrongOldPassword = true;\r\n                    passwordSuccess = false;\r\n                } else if (!pwResponse.ok) {\r\n                    passwordSuccess = false;\r\n                }\r\n            }\r\n\r\n            \/\/ 5. Send PUT request for Security Info (if fields are filled and password didn't fail)\r\n            if (isUpdatingSecurity && !wrongOldPassword) {\r\n                const secResponse = await fetch('https:\/\/drawings.salvatorerobuschi.com\/user\/profile\/security', {\r\n                    method: 'PUT',\r\n                    headers: headers,\r\n                    body: JSON.stringify({ \r\n                        secretQuestion: secretQuestion, \r\n                        secretAnswer: secretAnswer \r\n                    })\r\n                });\r\n\r\n                if (!secResponse.ok) {\r\n                    securitySuccess = false;\r\n                }\r\n            }\r\n\r\n            \/\/ Revert button text\r\n            if (submitBtnText) submitBtnText.innerText = originalText;\r\n\r\n            \/\/ 6. Handle the UI Response\r\n            if (wrongOldPassword) {\r\n                if (errorWrongPassword) errorWrongPassword.style.display = 'block';\r\n            } else if (passwordSuccess && securitySuccess) {\r\n                \/\/ Success!\r\n                if (successText) successText.style.display = 'block';\r\n                form.reset(); \/\/ Clear the form fields\r\n            } else {\r\n                \/\/ 401 or 500 error\r\n                alert(\"Si \u00e8 verificato un errore di autenticazione o del server. Effettua nuovamente l'accesso e riprova.\");\r\n            }\r\n            \r\n        } catch (error) {\r\n            console.error(\"Profile update error:\", error);\r\n            alert(\"Si \u00e8 verificato un errore di rete. Riprova pi\u00f9 tardi.\"); \r\n        }\r\n    });\r\n});\r\n<\/script><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-03765c0 e-con-full e-flex e-con e-child\" data-id=\"03765c0\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-99b512a elementor-widget elementor-widget-heading\" data-id=\"99b512a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Helpful links<\/p>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2d39a75 elementor-widget elementor-widget-text-editor\" data-id=\"2d39a75\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Already have an account?\u00a0<a href=\"\/en\/reserved-area\/login\/\">Log in<\/a><br \/>Not registered yet? <a href=\"\/en\/reserved-area\/register\">Register<\/a><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Want to change your password? All fields are required Passwords do not match Incorrect current password Password changed successfully Helpful links Already have an account?\u00a0Log inNot registered yet? Register<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":21836,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_wds_title":"Change password reserved area | Salvatore Robuschi","_wds_metadesc":"Change and update your account password in the Salvatore Robuschi reserved area. Manage your user profile and keep your login details secure.","_wds_focus-keywords":"change password,update password,salvatore robuschi account","_wds_meta-robots-adv":"","_wds_meta-robots-noindex":false,"_wds_meta-robots-nofollow":false,"_wds_meta-robots-index":false,"_wds_meta-robots-follow":false,"_wds_autolinks-exclude":false,"_wds_canonical":"","_wds_opengraph":[],"_wds_twitter":[],"footnotes":""},"class_list":["post-22956","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.salvatorerobuschi.com\/en\/wp-json\/wp\/v2\/pages\/22956","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.salvatorerobuschi.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.salvatorerobuschi.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.salvatorerobuschi.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.salvatorerobuschi.com\/en\/wp-json\/wp\/v2\/comments?post=22956"}],"version-history":[{"count":5,"href":"https:\/\/www.salvatorerobuschi.com\/en\/wp-json\/wp\/v2\/pages\/22956\/revisions"}],"predecessor-version":[{"id":23609,"href":"https:\/\/www.salvatorerobuschi.com\/en\/wp-json\/wp\/v2\/pages\/22956\/revisions\/23609"}],"up":[{"embeddable":true,"href":"https:\/\/www.salvatorerobuschi.com\/en\/wp-json\/wp\/v2\/pages\/21836"}],"wp:attachment":[{"href":"https:\/\/www.salvatorerobuschi.com\/en\/wp-json\/wp\/v2\/media?parent=22956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}