SECURITY: Destroy EmailToken when EmailChangeRequest is destroyed (#13950)

This commit is contained in:
jbrw
2021-08-04 19:14:56 -04:00
committed by GitHub
parent d8a0d2262c
commit fb14e50741
2 changed files with 15 additions and 2 deletions

View File

@ -1,8 +1,8 @@
# frozen_string_literal: true
class EmailChangeRequest < ActiveRecord::Base
belongs_to :old_email_token, class_name: 'EmailToken'
belongs_to :new_email_token, class_name: 'EmailToken'
belongs_to :old_email_token, class_name: 'EmailToken', dependent: :destroy
belongs_to :new_email_token, class_name: 'EmailToken', dependent: :destroy
belongs_to :user
belongs_to :requested_by, class_name: "User", foreign_key: :requested_by_user_id