diff --git a/assets/js/components/settings/interface.js b/assets/js/components/settings/interface.js index 2aacd220..f0b8cd40 100644 --- a/assets/js/components/settings/interface.js +++ b/assets/js/components/settings/interface.js @@ -31,6 +31,14 @@ const SettingsInterface = { ComunicWeb.common.api.makeAPIrequest(apiURI, settings, true, callback); }, + /** + * Get current user email address + */ + getMail: async function() { + const res = await api("account/mail", null, true); + return res.mail; + }, + /** * Check the availability of the virtual directory for user * diff --git a/assets/js/pages/settings/sections/password.js b/assets/js/pages/settings/sections/password.js index 0482af21..60128abd 100644 --- a/assets/js/pages/settings/sections/password.js +++ b/assets/js/pages/settings/sections/password.js @@ -62,8 +62,16 @@ ComunicWeb.pages.settings.sections.password = { tr("Your new password") ); (async () => { - let user = await userInfo(userID()); - newPasswordInput.setUser(user) + try { + let user = await userInfo(userID()); + newPasswordInput.setUser(user) + + let mail = await SettingsInterface.getMail() + newPasswordInput.setEmail(mail) + } catch(e) { + console.error(e); + notify(tr("Failed to load your information to prepare password update!"), "danger"); + } })(); //Ask the user to confirm its new password