🐛 Fix delete account at least destroy auth tickets

This commit is contained in:
LittleSheep 2025-02-20 21:22:36 +08:00
parent 76cc34c90a
commit a2d033b56c

View File

@ -329,6 +329,10 @@ func ConfirmResetPassword(code, newPassword string) error {
func DeleteAccount(id uint) error {
tx := database.C.Begin()
if err := tx.Delete(&models.AuthTicket{}, "account_id = ?", id).Error; err != nil {
tx.Rollback()
return err
}
if err := tx.Select(clause.Associations).Delete(&models.Account{}, "id = ?", id).Error; err != nil {
tx.Rollback()
return err