Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backend/internal/service/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ func (s *UserService) updateHeartBeat(userID uint) {
func (s *UserService) issueNewTokenForUser(ctx context.Context, userID uint, revokeAllTokens bool) (string, error) {

if revokeAllTokens {
_, err := gorm.G[model.Token](s.DB.Unscoped()).Where("user_id = ?", userID).Delete(ctx)
if err != nil {
return "", err
res := s.DB.WithContext(ctx).Exec("DELETE FROM tokens WHERE user_id = ?", userID)
if res.Error != nil {
return "", res.Error
}
}

Expand Down
6 changes: 3 additions & 3 deletions backend/internal/service/user_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ func (s *UserService) UpdateUserProfile(ctx context.Context, userID uint, reques
}

func (s *UserService) DeleteUser(ctx context.Context, userID uint) error {
_, err := gorm.G[model.User](s.DB.Unscoped()).Where("id = ?", userID).Delete(ctx)
if err != nil {
return err
res := s.DB.WithContext(ctx).Unscoped().Delete(&model.User{}, userID)
if res.Error != nil {
return res.Error
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/user/profile/Friends.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@

<span
title={friend.online ? 'Online' : 'Offline'}
class={cn('h-6 w-6 rounded-full', friend.online ? 'bg-green-500/20' : 'bg-gray-500/20')}
class={cn('h-6 w-6 rounded-full', friend.online ? 'bg-green-500/80' : 'bg-gray-500/80')}
></span>
</li>
{/each}
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/routes/user/settings/ChangePasswordForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
void confirmNewPassword;

try {
const user = await updatePassword(payload);
await updatePassword(payload);

toast.success('Password updated successfully! Redirecting to home page...');
userStore.login(user);
toast.success('Password updated successfully! Redirecting to login page...');
userStore.logout();

setTimeout(() => {
goto('/');
goto('/user/login');
}, 0);
} catch (error) {
if (error instanceof AuthError && error.status === 401) {
Expand All @@ -40,7 +40,7 @@
}

logger.error('Password update failed:', error);
toast.error('Login failed, please try again later.');
toast.error('Password update failed, please try again later.');
} finally {
form.data.oldPassword = '';
form.data.newPassword = '';
Expand Down
Loading