/** * Copyright (C) 2024 Puter Technologies Inc. * * This file is part of Puter. * * Puter is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ import UIWindowChangePassword from '../UIWindowChangePassword.js'; import UIWindowChangeEmail from './UIWindowChangeEmail.js'; import UIWindowChangeUsername from '../UIWindowChangeUsername.js'; import UIWindowConfirmUserDeletion from './UIWindowConfirmUserDeletion.js'; import UIWindowManageSessions from '../UIWindowManageSessions.js'; // About export default { id: 'account', title_i18n_key: 'account', icon: 'user.svg', html: () => { let h = `

${i18n('account')}

`; // change password button if(!window.user.is_temp){ h += `
`; h += `${i18n('password')}`; h += `
`; h += ``; h += `
`; h += `
`; } // change username button h += `
`; h += `
`; h += `${i18n('username')}`; h += `${html_encode(window.user.username)}`; h += `
`; h += `
`; h += ``; h += `
` h += `
`; // change email button if(window.user.email){ h += `
`; h += `
`; h += `${i18n('email')}`; h += `${html_encode(window.user.email)}`; h += `
`; h += `
`; h += ``; h += `
`; h += `
`; } // session manager h += `
`; h += `${i18n('sessions')}`; h += `
`; h += ``; h += `
`; h += `
`; // 'Delete Account' button h += `
`; h += `${i18n("delete_account")}`; h += `
`; h += ``; h += `
`; h += `
`; return h; }, init: ($el_window) => { $el_window.find('.change-password').on('click', function (e) { UIWindowChangePassword({ window_options:{ parent_uuid: $el_window.attr('data-element_uuid'), disable_parent_window: true, parent_center: true, } }); }); $el_window.find('.change-username').on('click', function (e) { UIWindowChangeUsername({ window_options:{ parent_uuid: $el_window.attr('data-element_uuid'), disable_parent_window: true, parent_center: true, } }); }); $el_window.find('.change-email').on('click', function (e) { UIWindowChangeEmail({ window_options:{ parent_uuid: $el_window.attr('data-element_uuid'), disable_parent_window: true, parent_center: true, } }); }); $el_window.find('.manage-sessions').on('click', function (e) { UIWindowManageSessions({ window_options:{ parent_uuid: $el_window.attr('data-element_uuid'), disable_parent_window: true, parent_center: true, } }); }); $el_window.find('.delete-account').on('click', function (e) { UIWindowConfirmUserDeletion({ window_options:{ parent_uuid: $el_window.attr('data-element_uuid'), disable_parent_window: true, parent_center: true, } }); }); }, };