-
Notifications
You must be signed in to change notification settings - Fork 143
Description
Severity: High
- Causes unintended data loss (profile picture deletion).
- Violates user expectations and may lead to frustration or confusion.
Describe the bug
When a user changes their username on the Account Settings page, the app unexpectedly deletes the existing profile picture. This violates data integrity expectations and risks unintended data loss.
To Reproduce
Steps to reproduce the behavior:
- Navigate to https://app.aixblock.io/user/account.
- Upload a profile picture (e.g., example.jpg).
- Change the username (e.g., from oldusername to clangofthebell).
- Click Save or Update.
- Observe that the profile picture is deleted after the username change.
Expected behavior
Changing the username should not affect the profile picture. The picture should remain unchanged unless explicitly deleted by the user.
Videos & Screenshot

https://drive.google.com/file/d/1BwR2PhIxljSkgfKCsYzgC0TGfKy9N55r/view?usp=sharing
Desktop (please complete the following information):
OS: Windows 11
Browser Chrome
Version v139.0.7258.139
Additional context
Users may lose their profile picture without warning, requiring re-upload.
Suggested Fix
Frontend Fix:
Ensure the profile picture is not cleared during username updates.
Example fix (JavaScript):
javascript
// Preserve profile picture during username update
const updateUsername = async (newUsername) => {
const response = await fetch('/api/update-username', {
method: 'POST',
body: JSON.stringify({ username: newUsername }),
});
if (response.ok) {
// Do NOT reset profile picture
alert("Username updated successfully!");
}
};
Backend Fix (Critical):
Ensure the username update API does not delete the profile picture.
Example (Node.js/Express):
javascript
app.post('/api/update-username', async (req, res) => {
const { username } = req.body;
const user = await User.findById(req.user.id);
user.username = username;
await user.save(); // Do NOT touch profilePicture field
res.status(200).send("Username updated");
});