Add support for account deletion

This commit is contained in:
Nariman Jelveh
2024-03-24 17:39:46 -07:00
parent 52d1bd1f03
commit d13ae6958c
8 changed files with 515 additions and 86 deletions

View File

@@ -0,0 +1,97 @@
/**
* 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 <https://www.gnu.org/licenses/>.
*/
// About
function UITabAbout(){
let h = ``;
h += `<div class="settings-content active" data-settings="about">`;
h += `<div class="about-container">`
h += `<div class="about" style="text-align: center;">
<a href="https://puter.com" target="_blank" class="logo"><img src="/images/logo.png"></a>
<p class="description">Puter is a privacy-first personal cloud to keep all your files, apps, and games in one
secure place, accessible from anywhere at any time.</p>
<p class="links">
<a href="mailto:hey@puter.com" target="_blank">hey@puter.com</a>
<span style="color: #CCC;">•</span>
<a href="https://docs.puter.com" target="_blank">Developers</a>
<span style="color: #CCC;">•</span>
<a href="https://status.puter.com" target="_blank">Status</a>
<span style="color: #CCC;">•</span>
<a href="https://puter.com/terms" target="_blank">Terms</a>
<span style="color: #CCC;">•</span>
<a href="https://puter.com/privacy" target="_blank">Privacy</a>
<span style="color: #CCC;">•</span>
<a href="#" class="show-credits">Credits</a>
</p>
<div class="social-links">
<a href="https://twitter.com/HeyPuter/" target="_blank">
<svg viewBox="0 0 24 24" aria-hidden="true" style="opacity: 0.7;"><g><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"></path></g></svg>
</a>
<a href="https://github.com/HeyPuter/" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="48px" height="48px" viewBox="0 0 48 48">
<g transform="translate(0, 0)">
<path fill-rule="evenodd" clip-rule="evenodd" fill="#5a606b" d="M24,0.6c-13.3,0-24,10.7-24,24c0,10.6,6.9,19.6,16.4,22.8 c1.2,0.2,1.6-0.5,1.6-1.2c0-0.6,0-2.1,0-4.1c-6.7,1.5-8.1-3.2-8.1-3.2c-1.1-2.8-2.7-3.5-2.7-3.5c-2.2-1.5,0.2-1.5,0.2-1.5 c2.4,0.2,3.7,2.5,3.7,2.5c2.1,3.7,5.6,2.6,7,2c0.2-1.6,0.8-2.6,1.5-3.2c-5.3-0.6-10.9-2.7-10.9-11.9c0-2.6,0.9-4.8,2.5-6.4 c-0.2-0.6-1.1-3,0.2-6.4c0,0,2-0.6,6.6,2.5c1.9-0.5,4-0.8,6-0.8c2,0,4.1,0.3,6,0.8c4.6-3.1,6.6-2.5,6.6-2.5c1.3,3.3,0.5,5.7,0.2,6.4 c1.5,1.7,2.5,3.8,2.5,6.4c0,9.2-5.6,11.2-11,11.8c0.9,0.7,1.6,2.2,1.6,4.4c0,3.2,0,5.8,0,6.6c0,0.6,0.4,1.4,1.7,1.2 C41.1,44.2,48,35.2,48,24.6C48,11.3,37.3,0.6,24,0.6z">
</path>
</g>
</svg>
</a>
<a href="https://discord.gg/PQcx7Teh8u" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="48px" height="48px" viewBox="0 0 48 48"><g transform="translate(0, 0)"><path d="M19.837,20.3a2.562,2.562,0,0,0,0,5.106,2.562,2.562,0,0,0,0-5.106Zm8.4,0a2.562,2.562,0,1,0,2.346,2.553A2.45,2.45,0,0,0,28.232,20.3Z" fill="#444444" data-color="color-2"></path> <path d="M39.41,1H8.59A4.854,4.854,0,0,0,4,6V37a4.482,4.482,0,0,0,4.59,4.572H34.672l-1.219-4.255L36.4,40.054,39.18,42.63,44,47V6A4.854,4.854,0,0,0,39.41,1ZM30.532,31.038s-.828-.989-1.518-1.863a7.258,7.258,0,0,0,4.163-2.737A13.162,13.162,0,0,1,30.532,27.8a15.138,15.138,0,0,1-3.335.989,16.112,16.112,0,0,1-5.957-.023,19.307,19.307,0,0,1-3.381-.989,13.112,13.112,0,0,1-2.622-1.357,7.153,7.153,0,0,0,4.025,2.714c-.69.874-1.541,1.909-1.541,1.909-5.083-.161-7.015-3.5-7.015-3.5a30.8,30.8,0,0,1,3.312-13.409,11.374,11.374,0,0,1,6.463-2.415l.23.276a15.517,15.517,0,0,0-6.049,3.013s.506-.276,1.357-.667a17.272,17.272,0,0,1,5.221-1.449,2.266,2.266,0,0,1,.391-.046,19.461,19.461,0,0,1,4.646-.046A18.749,18.749,0,0,1,33.2,15.007a15.307,15.307,0,0,0-5.727-2.921l.322-.368a11.374,11.374,0,0,1,6.463,2.415A30.8,30.8,0,0,1,37.57,27.542S35.615,30.877,30.532,31.038Z" fill="#444444"></path></g></svg> </a>
<a href="https://www.linkedin.com/company/puter/" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="48px" height="48px" viewBox="0 0 48 48">
<g transform="translate(0, 0)">
<path fill="#5a606b" d="M46,0H2C0.9,0,0,0.9,0,2v44c0,1.1,0.9,2,2,2h44c1.1,0,2-0.9,2-2V2C48,0.9,47.1,0,46,0z M14.2,40.9H7.1V18 h7.1V40.9z M10.7,14.9c-2.3,0-4.1-1.8-4.1-4.1c0-2.3,1.8-4.1,4.1-4.1c2.3,0,4.1,1.8,4.1,4.1C14.8,13,13,14.9,10.7,14.9z M40.9,40.9 h-7.1V29.8c0-2.7,0-6.1-3.7-6.1c-3.7,0-4.3,2.9-4.3,5.9v11.3h-7.1V18h6.8v3.1h0.1c0.9-1.8,3.3-3.7,6.7-3.7c7.2,0,8.5,4.7,8.5,10.9 V40.9z">
</path>
</g>
</svg>
</a>
</div>
</div>
<div class="version"></div>
<dialog class="credits">
<div class="credit-content">
<p style="margin: 0; font-size: 18px; text-align: center;">Open Source Software and Content</p>
<div style="max-height: 300px; overflow-y: scroll;">
<ul style="padding-left: 25px; padding-top:15px;">
<li>FileSaver.js <a target="_blank" href="https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md">license</a></li>
<li>html-entities <a target="_blank" href="https://github.com/mdevils/html-entities/blob/master/LICENSE">license</a></li>
<li>iro.js <a target="_blank" href="https://github.com/jaames/iro.js/blob/master/LICENSE.txt">license</a></li>
<li>jQuery <a target="_blank" href="https://jquery.org/license/">license</a></li>
<li>jQuery-dragster <a target="_blank" href="https://github.com/catmanjan/jquery-dragster/blob/master/LICENSE">license</a></li>
<li>jQuery UI <a target="_blank" href="https://jquery.org/license/">license</a></li>
<li>lodash <a target="_blank" href="https://lodash.com/license">license</a></li>
<li>mime <a target="_blank" href="https://github.com/broofa/mime/blob/main/LICENSE">license</a></li>
<li>qrcodejs <a target="_blank" href="https://github.com/davidshimjs/qrcodejs/blob/master/LICENSE">license</a></li>
<li>Selection <a target="_blank" href="https://github.com/simonwep/selection/blob/master/LICENSE">license</a></li>
<li>socket.io <a target="_blank" href="https://github.com/socketio/socket.io/blob/main/LICENSE">license</a></li>
<li>Wallpaper by <a target="_blank" href="https://unsplash.com/@fakurian?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Milad Fakurian</a> on <a target="_blank" href="https://unsplash.com/photos/blue-orange-and-yellow-wallpaper-E8Ufcyxz514?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Unsplash</a></li>
</ul>
</div>
</div>
</dialog>
`;
h += `</div>`;
h += `</div>`;
return h;
}
export default UITabAbout;

View File

@@ -0,0 +1,83 @@
/**
* 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 <https://www.gnu.org/licenses/>.
*/
import UIWindow from '../UIWindow.js'
import UIWindowFinalizeUserDeletion from './UIWindowFinalizeUserDeletion.js'
async function UIWindowConfirmUserDeletion(options){
return new Promise(async (resolve) => {
options = options ?? {};
let h = '';
h += `<div style="padding: 20px;">`;
h += `<div class="generic-close-window-button disable-user-select"> &times; </div>`;
h += `<img src="${window.icons['danger.svg']}" style="width: 70px; margin: 20px auto 20px; display: block; margin-bottom: 20px;">`;
h += `<p style="text-align: center; font-size: 16px; padding: 20px; font-weight: 400; margin: -10px 10px 20px 10px; -webkit-font-smoothing: antialiased; color: #5f626d;">${i18n('confirm_delete_user')}</p>`;
h += `<button class="button button-block button-danger proceed-with-user-deletion" style="margin-bottom: 20px;">${i18n('proceed_with_account_deletion')}</button>`;
h += `<button class="button button-block button-secondary cancel-user-deletion">${i18n('cancel')}</button>`;
h += `</div>`;
const el_window = await UIWindow({
title: i18n('confirm_delete_user_title'),
icon: null,
uid: null,
is_dir: false,
body_content: h,
has_head: false,
selectable_body: false,
draggable_body: false,
allow_context_menu: false,
is_draggable: true,
is_resizable: false,
is_droppable: false,
init_center: true,
allow_native_ctxmenu: true,
allow_user_select: true,
backdrop: true,
onAppend: function(el_window){
},
width: 500,
dominant: true,
window_css: {
height: 'initial',
padding: '0',
border: 'none',
boxShadow: '0 0 10px rgba(0,0,0,.2)',
borderRadius: '5px',
backgroundColor: 'white',
color: 'black',
},
});
$(el_window).find('.generic-close-window-button').on('click', function(){
$(el_window).close();
});
$(el_window).find('.cancel-user-deletion').on('click', function(){
$(el_window).close();
});
$(el_window).find('.proceed-with-user-deletion').on('click', function(){
UIWindowFinalizeUserDeletion();
$(el_window).close();
});
})
}
export default UIWindowConfirmUserDeletion;

View File

@@ -0,0 +1,152 @@
/**
* 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 <https://www.gnu.org/licenses/>.
*/
import UIWindow from '../UIWindow.js'
async function UIWindowFinalizeUserDeletion(options){
return new Promise(async (resolve) => {
options = options ?? {};
let h = '';
// if user is temporary, ask them to type in 'confirm' to delete their account
if(user.is_temp){
h += `<div style="padding: 20px;">`;
h += `<div class="generic-close-window-button disable-user-select"> &times; </div>`;
h += `<img src="${window.icons['danger.svg']}" style="width: 70px; margin: 20px auto 20px; display: block; margin-bottom: 20px;">`;
h += `<p style="text-align: center; font-size: 16px; padding: 20px; font-weight: 400; margin: -10px 10px 20px 10px; -webkit-font-smoothing: antialiased; color: #5f626d;">${i18n('type_confirm_to_delete_account')}</p>`;
// error message
h += `<div class="error-message" style="display: none;"></div>`;
// input field
h += `<input type="text" class="confirm-temporary-user-deletion" placeholder="${i18n('type_confirm_to_delete_account')}" style="width: 100%; margin-bottom: 20px;">`;
h += `<button class="button button-block button-danger proceed-with-user-deletion" style="margin-bottom: 20px;">${i18n('delete_account')}</button>`;
h += `<button class="button button-block button-secondary cancel-user-deletion">${i18n('cancel')}</button>`;
h += `</div>`;
}
// otherwise ask for password
else{
h += `<div style="padding: 20px;">`;
h += `<div class="generic-close-window-button disable-user-select"> &times; </div>`;
h += `<img src="${window.icons['danger.svg']}" style="width: 70px; margin: 20px auto 20px; display: block; margin-bottom: 20px;">`;
h += `<p style="text-align: center; font-size: 16px; padding: 20px; font-weight: 400; margin: -10px 10px 20px 10px; -webkit-font-smoothing: antialiased; color: #5f626d;">${i18n('enter_password_to_confirm_delete_user')}</p>`;
// error message
h += `<div class="error-message" style="display: none;"></div>`;
// input field
h += `<input type="password" class="confirm-user-deletion-password" placeholder="${i18n('current_password')}" style="width: 100%; margin-bottom: 20px;">`;
h += `<button class="button button-block button-danger proceed-with-user-deletion" style="margin-bottom: 20px;">${i18n('delete_account')}</button>`;
h += `<button class="button button-block button-secondary cancel-user-deletion">${i18n('cancel')}</button>`;
h += `</div>`;
}
const el_window = await UIWindow({
title: i18n('confirm_delete_user_title'),
icon: null,
uid: null,
is_dir: false,
body_content: h,
has_head: false,
selectable_body: false,
draggable_body: false,
allow_context_menu: false,
is_draggable: true,
is_resizable: false,
is_droppable: false,
init_center: true,
allow_native_ctxmenu: true,
allow_user_select: true,
backdrop: true,
onAppend: function(el_window){
},
width: 500,
dominant: false,
window_css: {
height: 'initial',
padding: '0',
border: 'none',
boxShadow: '0 0 10px rgba(0,0,0,.2)',
}
});
$(el_window).find('.generic-close-window-button').on('click', function(){
$(el_window).close();
});
$(el_window).find('.cancel-user-deletion').on('click', function(){
$(el_window).close();
});
$(el_window).find('.proceed-with-user-deletion').on('click', function(){
$(el_window).find('.error-message').hide();
// if user is temporary, check if they typed 'confirm'
if(user.is_temp){
if($(el_window).find('.confirm-temporary-user-deletion').val() !== 'confirm'){
$(el_window).find('.error-message').html(i18n('type_confirm_to_delete_account'), false);
$(el_window).find('.error-message').show();
return;
}
}
// otherwise, check if password is correct
else{
if($(el_window).find('.confirm-user-deletion-password').val() === ''){
$(el_window).find('.error-message').html(i18n('all_fields_required'), false);
$(el_window).find('.error-message').show();
return;
}
}
// delete user
$.ajax({
url: api_origin + "/delete-own-user",
type: 'POST',
async: true,
contentType: "application/json",
headers: {
"Authorization": "Bearer " + auth_token
},
data: JSON.stringify({
password: $(el_window).find('.confirm-user-deletion-password').val(),
}),
statusCode: {
401: function () {
logout();
},
400: function(){
$(el_window).find('.error-message').html(i18n('incorrect_password'));
$(el_window).find('.error-message').show();
}
},
success: function(data){
if(data.success){
// mark user as deleted
window.user.deleted = true;
// log user out
logout();
}
else{
$(el_window).find('.error-message').html(data.error);
$(el_window).find('.error-message').show();
}
}
});
});
})
}
export default UIWindowFinalizeUserDeletion;

View File

@@ -23,7 +23,8 @@ import UIWindowChangePassword from '../UIWindowChangePassword.js'
// import UIWindowDeleteAccount from './UIWindowDeleteAccount.js'
import UIWindowChangeUsername from '../UIWindowChangeUsername.js'
import changeLanguage from "../../i18n/i18nchangeLanguage.js"
import UIWindowConfirmUserDeletion from './UIWindowConfirmUserDeletion.js';
import UITabAbout from './UITabAbout.js';
async function UIWindowSettings(options){
return new Promise(async (resolve) => {
@@ -43,76 +44,9 @@ async function UIWindowSettings(options){
// content
h += `<div class="settings-content-container">`;
// About
h += `<div class="settings-content active" data-settings="about">`;
h += `<div class="about-container">`
h += `<div class="about" style="text-align: center;">
<a href="https://puter.com" target="_blank" class="logo"><img src="/images/logo.png"></a>
<p class="description">Puter is a privacy-first personal cloud to keep all your files, apps, and games in one
secure place, accessible from anywhere at any time.</p>
<p class="links">
<a href="mailto:hey@puter.com" target="_blank">hey@puter.com</a>
<span style="color: #CCC;">•</span>
<a href="https://docs.puter.com" target="_blank">Developers</a>
<span style="color: #CCC;">•</span>
<a href="https://status.puter.com" target="_blank">Status</a>
<span style="color: #CCC;">•</span>
<a href="https://puter.com/terms" target="_blank">Terms</a>
<span style="color: #CCC;">•</span>
<a href="https://puter.com/privacy" target="_blank">Privacy</a>
<span style="color: #CCC;">•</span>
<a href="#" class="show-credits">Credits</a>
</p>
<div class="social-links">
<a href="https://twitter.com/HeyPuter/" target="_blank">
<svg viewBox="0 0 24 24" aria-hidden="true" style="opacity: 0.7;"><g><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"></path></g></svg>
</a>
<a href="https://github.com/HeyPuter/" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="48px" height="48px" viewBox="0 0 48 48">
<g transform="translate(0, 0)">
<path fill-rule="evenodd" clip-rule="evenodd" fill="#5a606b" d="M24,0.6c-13.3,0-24,10.7-24,24c0,10.6,6.9,19.6,16.4,22.8 c1.2,0.2,1.6-0.5,1.6-1.2c0-0.6,0-2.1,0-4.1c-6.7,1.5-8.1-3.2-8.1-3.2c-1.1-2.8-2.7-3.5-2.7-3.5c-2.2-1.5,0.2-1.5,0.2-1.5 c2.4,0.2,3.7,2.5,3.7,2.5c2.1,3.7,5.6,2.6,7,2c0.2-1.6,0.8-2.6,1.5-3.2c-5.3-0.6-10.9-2.7-10.9-11.9c0-2.6,0.9-4.8,2.5-6.4 c-0.2-0.6-1.1-3,0.2-6.4c0,0,2-0.6,6.6,2.5c1.9-0.5,4-0.8,6-0.8c2,0,4.1,0.3,6,0.8c4.6-3.1,6.6-2.5,6.6-2.5c1.3,3.3,0.5,5.7,0.2,6.4 c1.5,1.7,2.5,3.8,2.5,6.4c0,9.2-5.6,11.2-11,11.8c0.9,0.7,1.6,2.2,1.6,4.4c0,3.2,0,5.8,0,6.6c0,0.6,0.4,1.4,1.7,1.2 C41.1,44.2,48,35.2,48,24.6C48,11.3,37.3,0.6,24,0.6z">
</path>
</g>
</svg>
</a>
<a href="https://discord.gg/PQcx7Teh8u" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="48px" height="48px" viewBox="0 0 48 48"><g transform="translate(0, 0)"><path d="M19.837,20.3a2.562,2.562,0,0,0,0,5.106,2.562,2.562,0,0,0,0-5.106Zm8.4,0a2.562,2.562,0,1,0,2.346,2.553A2.45,2.45,0,0,0,28.232,20.3Z" fill="#444444" data-color="color-2"></path> <path d="M39.41,1H8.59A4.854,4.854,0,0,0,4,6V37a4.482,4.482,0,0,0,4.59,4.572H34.672l-1.219-4.255L36.4,40.054,39.18,42.63,44,47V6A4.854,4.854,0,0,0,39.41,1ZM30.532,31.038s-.828-.989-1.518-1.863a7.258,7.258,0,0,0,4.163-2.737A13.162,13.162,0,0,1,30.532,27.8a15.138,15.138,0,0,1-3.335.989,16.112,16.112,0,0,1-5.957-.023,19.307,19.307,0,0,1-3.381-.989,13.112,13.112,0,0,1-2.622-1.357,7.153,7.153,0,0,0,4.025,2.714c-.69.874-1.541,1.909-1.541,1.909-5.083-.161-7.015-3.5-7.015-3.5a30.8,30.8,0,0,1,3.312-13.409,11.374,11.374,0,0,1,6.463-2.415l.23.276a15.517,15.517,0,0,0-6.049,3.013s.506-.276,1.357-.667a17.272,17.272,0,0,1,5.221-1.449,2.266,2.266,0,0,1,.391-.046,19.461,19.461,0,0,1,4.646-.046A18.749,18.749,0,0,1,33.2,15.007a15.307,15.307,0,0,0-5.727-2.921l.322-.368a11.374,11.374,0,0,1,6.463,2.415A30.8,30.8,0,0,1,37.57,27.542S35.615,30.877,30.532,31.038Z" fill="#444444"></path></g></svg> </a>
<a href="https://www.linkedin.com/company/puter/" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="48px" height="48px" viewBox="0 0 48 48">
<g transform="translate(0, 0)">
<path fill="#5a606b" d="M46,0H2C0.9,0,0,0.9,0,2v44c0,1.1,0.9,2,2,2h44c1.1,0,2-0.9,2-2V2C48,0.9,47.1,0,46,0z M14.2,40.9H7.1V18 h7.1V40.9z M10.7,14.9c-2.3,0-4.1-1.8-4.1-4.1c0-2.3,1.8-4.1,4.1-4.1c2.3,0,4.1,1.8,4.1,4.1C14.8,13,13,14.9,10.7,14.9z M40.9,40.9 h-7.1V29.8c0-2.7,0-6.1-3.7-6.1c-3.7,0-4.3,2.9-4.3,5.9v11.3h-7.1V18h6.8v3.1h0.1c0.9-1.8,3.3-3.7,6.7-3.7c7.2,0,8.5,4.7,8.5,10.9 V40.9z">
</path>
</g>
</svg>
</a>
</div>
</div>
<div class="version"></div>
<dialog class="credits">
<div class="credit-content">
<p style="margin: 0; font-size: 18px; text-align: center;">Open Source Software and Content</p>
<div style="max-height: 300px; overflow-y: scroll;">
<ul style="padding-left: 25px; padding-top:15px;">
<li>FileSaver.js <a target="_blank" href="https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md">license</a></li>
<li>html-entities <a target="_blank" href="https://github.com/mdevils/html-entities/blob/master/LICENSE">license</a></li>
<li>iro.js <a target="_blank" href="https://github.com/jaames/iro.js/blob/master/LICENSE.txt">license</a></li>
<li>jQuery <a target="_blank" href="https://jquery.org/license/">license</a></li>
<li>jQuery-dragster <a target="_blank" href="https://github.com/catmanjan/jquery-dragster/blob/master/LICENSE">license</a></li>
<li>jQuery UI <a target="_blank" href="https://jquery.org/license/">license</a></li>
<li>lodash <a target="_blank" href="https://lodash.com/license">license</a></li>
<li>mime <a target="_blank" href="https://github.com/broofa/mime/blob/main/LICENSE">license</a></li>
<li>qrcodejs <a target="_blank" href="https://github.com/davidshimjs/qrcodejs/blob/master/LICENSE">license</a></li>
<li>Selection <a target="_blank" href="https://github.com/simonwep/selection/blob/master/LICENSE">license</a></li>
<li>socket.io <a target="_blank" href="https://github.com/socketio/socket.io/blob/main/LICENSE">license</a></li>
<li>Wallpaper by <a target="_blank" href="https://unsplash.com/@fakurian?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Milad Fakurian</a> on <a target="_blank" href="https://unsplash.com/photos/blue-orange-and-yellow-wallpaper-E8Ufcyxz514?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Unsplash</a></li>
</ul>
</div>
</div>
</dialog>
`;
h += `</div>`;
h += `</div>`;
h += UITabAbout();
// Usage
h += `<div class="settings-content" data-settings="usage">`;
@@ -142,16 +76,6 @@ async function UIWindowSettings(options){
h += `</div>`;
h += `</div>`;
// change email button
if(user.email){
h += `<div class="settings-card">`;
h += `<strong>${user.email}</strong>`;
h += `<div style="flex-grow:1;">`;
h += `<button class="button change-email" style="margin-bottom: 10px;">Change Email</button>`;
h += `</div>`;
h += `</div>`;
}
// change username button
h += `<div class="settings-card">`;
h += `<div>`;
@@ -163,11 +87,24 @@ async function UIWindowSettings(options){
h += `</div>`
h += `</div>`;
// delete account button
// change email button
if(user.email){
h += `<div class="settings-card">`;
h += `<div>`;
h += `<strong style="display:block;">Email</strong>`;
h += `<span style="display:block; margin-top:5px;">${user.email}</span>`;
h += `</div>`;
h += `<div style="flex-grow:1;">`;
h += `<button class="button change-email" style="margin-bottom: 10px; float:right;">Change Email</button>`;
h += `</div>`;
h += `</div>`;
}
// 'Delete Account' button
h += `<div class="settings-card settings-card-danger">`;
h += `<strong style="display: inline-block;">Delete Account</strong>`;
h += `<strong style="display: inline-block;">${i18n("delete_account")}</strong>`;
h += `<div style="flex-grow:1;">`;
h += `<button class="button button-danger delete-account" style="float:right;">Delete Account</button>`;
h += `<button class="button button-danger delete-account" style="float:right;">${i18n("delete_account")}</button>`;
h += `</div>`;
h += `</div>`;
@@ -349,7 +286,7 @@ async function UIWindowSettings(options){
})
$(el_window).find('.delete-account').on('click', function (e) {
UIWindowDeleteAccount();
UIWindowConfirmUserDeletion();
})
$(el_window).find('.change-username').on('click', function (e) {

View File

@@ -3549,4 +3549,15 @@ label {
border-color: #f0080866;
background: #ffecec;
color: rgb(215 2 2);
}
.error-message{
border-color: #f0080866;
background: #ffecec;
color: rgb(215 2 2);
font-size: 14px;
margin-top: 10px;
margin-bottom: 10px;
padding: 10px;
border-radius: 4px;
border: 1px solid #f0080866;
}

View File

@@ -46,6 +46,7 @@ const en = {
confirm_delete_single_item: 'Do you want to permanently delete this item?',
confirm_open_apps_log_out: 'You have open apps. Are you sure you want to log out?',
confirm_new_password: "Confirm New Password",
confirm_delete_user: "Are you sure you want to delete your account? All your files and data will be permanently deleted. This action cannot be undone.",
contact_us: "Contact Us",
contain: 'Contain',
continue: "Continue",
@@ -60,6 +61,7 @@ const en = {
cut: 'Cut',
date_modified: 'Date modified',
delete: 'Delete',
delete_account: "Delete Account",
delete_permanently: "Delete Permanently",
deploy_as_app: 'Deploy as app',
descending: 'Descending',
@@ -74,6 +76,7 @@ const en = {
empty_trash: 'Empty Trash',
empty_trash_confirmation: `Are you sure you want to permanently delete the items in Trash?`,
emptying_trash: 'Emptying Trash…',
enter_password_to_confirm_delete_user: "Enter your password to confirm account deletion",
feedback: "Feedback",
feedback_c2a: "Please use the form below to send us your feedback, comments, and bug reports.",
feedback_sent_confirmation: "Thank you for contacting us. If you have an email associated with your account, you will hear back from us as soon as possible.",
@@ -124,14 +127,15 @@ const en = {
paste_into_folder: "Paste Into Folder",
pick_name_for_website: "Pick a name for your website:",
picture: "Picture",
plural_suffix: 's',
powered_by_puter_js: `Powered by <a href="https://docs.puter.com/" target="_blank">Puter.js</a>`,
preparing: "Preparing...",
preparing_for_upload: "Preparing for upload...",
proceed_to_login: 'Proceed to login',
proceed_with_account_deletion: "Proceed with Account Deletion",
properties: "Properties",
publish: "Publish",
publish_as_website: 'Publish as website',
plural_suffix: 's',
recent: "Recent",
recover_password: "Recover Password",
refer_friends_c2a: "Get 1 GB for every friend who creates and confirms an account on Puter. Your friend will get 1 GB too!",
@@ -174,6 +178,7 @@ const en = {
tos_fineprint: `By clicking 'Create Free Account' you agree to Puter's <a href="https://puter.com/terms" target="_blank">Terms of Service</a> and <a href="https://puter.com/privacy" target="_blank">Privacy Policy</a>.`,
trash: 'Trash',
type: 'Type',
type_confirm_to_delete_account: "Type 'confirm' to delete your account.",
undo: 'Undo',
unzip: "Unzip",
upload: 'Upload',

144
src/icons/danger.svg Normal file
View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg3468"
height="48"
width="48"
version="1.1">
<defs
id="defs3470">
<linearGradient
id="linearGradient4011">
<stop
offset="0"
style="stop-color:#ffffff;stop-opacity:1"
id="stop4013" />
<stop
offset="0.507761"
style="stop-color:#ffffff;stop-opacity:0.23529412"
id="stop4015" />
<stop
offset="0.83456558"
style="stop-color:#ffffff;stop-opacity:0.15686275"
id="stop4017" />
<stop
offset="1"
style="stop-color:#ffffff;stop-opacity:0.39215687"
id="stop4019" />
</linearGradient>
<linearGradient
id="linearGradient947">
<stop
offset="0"
style="stop-color:#ed5353;stop-opacity:1"
id="stop943" />
<stop
offset="1"
style="stop-color:#c6262e;stop-opacity:1"
id="stop945" />
</linearGradient>
<linearGradient
x1="2035.1652"
y1="3208.0737"
x2="2035.1652"
y2="3241.9966"
id="linearGradient11527-6-5-3"
xlink:href="#linearGradient947"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.5712555,0,0,1.1746645,-3179.5055,-3763.7759)" />
<linearGradient
x1="71.204407"
y1="6.2375584"
x2="71.204407"
y2="44.340794"
id="linearGradient3019"
xlink:href="#linearGradient4011"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.054054,0,0,1.054054,-51.611001,-2.727901)" />
<radialGradient
xlink:href="#linearGradient3820-7-2"
id="radialGradient3300-8"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.3823536,7.5555777e-8,-1.8372241e-8,0.1115198,-5.9254271,36.335849)"
cx="99.189415"
cy="185.29727"
fx="99.189415"
fy="185.29727"
r="62.769119" />
<linearGradient
id="linearGradient3820-7-2">
<stop
id="stop3822-2-6"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop3824-1-2"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
xlink:href="#linearGradient3820-7-2"
id="radialGradient4192-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.2549024,5.3967361e-8,-1.2248161e-8,0.07965545,6.7163816,44.240666)"
cx="99.189415"
cy="185.29727"
fx="99.189415"
fy="185.29727"
r="62.769119" />
</defs>
<metadata
id="metadata3473">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="g4198-4"
transform="matrix(0.70833333,0,0,0.71428273,1.33333,0.78460484)"
style="stroke-width:1.40587306">
<path
d="m 55.999998,57.0017 a 24,6.9985714 0 1 1 -47.9999991,0 24,6.9985714 0 1 1 47.9999991,0 z"
id="path3818-0-6"
style="opacity:0.2;fill:url(#radialGradient3300-8);fill-opacity:1;stroke:none;stroke-width:1.40587306" />
<path
style="opacity:0.4;fill:url(#radialGradient4192-6);fill-opacity:1;stroke:none;stroke-width:1.40587306"
id="path4190-2"
d="m 47.999998,59.0017 a 16,4.9988822 0 1 1 -31.999999,0 16,4.9988822 0 1 1 31.999999,0 z" />
</g>
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.98999999;fill:url(#linearGradient11527-6-5-3);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999988;marker:none;enable-background:accumulate"
id="path2555-7-8-5-0-9"
d="m 24,3.4999989 c -11.311197,0 -20.5000003,9.1888021 -20.5000003,20.5000001 0,11.311197 9.1888033,20.5 20.5000003,20.5 11.311197,0 20.500019,-9.188803 20.5,-20.5 C 44.5,12.688801 35.311197,3.4999989 24,3.4999989 Z" />
<path
d="m 43.5,23.999308 c 0,10.7699 -8.73109,19.50069 -19.499753,19.50069 -10.769649,0 -19.5002474,-8.730889 -19.5002474,-19.50069 0,-10.769402 8.7305984,-19.4993079 19.5002474,-19.4993079 C 34.76891,4.5000001 43.5,13.229906 43.5,23.999308 l 0,0 z"
id="path8655"
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.4;fill:none;stroke:url(#linearGradient3019);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
<path
d="M 24.000003,3.4999979 C 12.68881,3.4999979 3.4999996,12.688804 3.4999996,23.999998 3.4999996,35.311192 12.68881,44.500003 24.000003,44.5 35.311191,44.5 44.500011,35.311192 44.5,23.999998 44.5,12.688804 35.311191,3.4999979 24.000003,3.4999979 Z"
id="path2555-6"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.5;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#7a0000;stroke-width:0.99999988;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<path
style="opacity:0.05;fill:#7a0000;fill-opacity:1;stroke:none;stroke-width:0.83747208;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
id="path4159-7-3"
d="m 24,10.855455 c -2.197926,0 -4,1.802074 -4,4 0,3.238442 1.017769,7.210006 2.019665,15.225174 a 0.98016537,0.98016537 0 0 0 0.973452,0.857424 l 2.013766,0 a 0.98016537,0.98016537 0 0 0 0.973452,-0.857424 C 26.982231,22.065461 28,18.093897 28,14.855455 c 0,-2.197926 -1.802074,-4 -4,-4 z M 24,32 c -2.197926,0 -4,1.802074 -4,4 0,2.197926 1.802074,4 4,4 2.197926,0 4,-1.802074 4,-4 0,-2.197926 -1.802074,-4 -4,-4 z" />
<path
style="opacity:0.15;fill:#7a0000;fill-opacity:1;stroke:none;stroke-width:0.84323651;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
d="m 24,12 c -1.656854,0 -3,1.343147 -3,3 0,3 1,7 2,15 l 2,0 c 1,-8 2,-12 2,-14.999999 0,-1.656854 -1.343146,-3 -3,-3 z m 0,21 c -1.656854,0 -3,1.343146 -3,3 0,1.656854 1.343146,3 3,3 1.656854,0 3,-1.343146 3,-3 0,-1.656854 -1.343146,-3 -3,-3 z"
id="path4159-7" />
<path
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.49803922"
d="m 24,11 c -1.656854,0 -3,1.343147 -3,3 0,3 1,7 2,15 l 2,0 C 26,21 27,17 27,14.000001 27,12.343147 25.656854,11 24,11 Z m 0,21 c -1.656854,0 -3,1.343146 -3,3 0,1.656854 1.343146,3 3,3 1.656854,0 3,-1.343146 3,-3 0,-1.656854 -1.343146,-3 -3,-3 z"
id="path4159" />
</svg>

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -1870,7 +1870,7 @@ window.initgui = async function(){
*/
$(document).on("logout", async function(event) {
// is temp user?
if(window.user && window.user.is_temp){
if(window.user && window.user.is_temp && !window.user.deleted){
const alert_resp = await UIAlert({
message: `<strong>Save account before logging out!</strong><p>You are using a temporary account and logging out will erase all your data.</p>`,
buttons:[