Unable to confirm new email when two factor backup codes are enabled

There’s definitely a bug here. To refine repro steps a bit:

  1. Setup 2FA with TOTP
  2. Enable backup codes
  3. Change email address
  4. Select the verification link in the confirmation email
  5. Get hit with the “Oops” page

I can confirm that disabling the backup codes will immediately fix the issue, even when using the same email verification link.

Error log shows:

ActionView::Template::Error (Missing partial common/_second_factor_form_script with {:locale=>[:en_US, :en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby]}. Searched in:
  * "/var/www/discourse/app/views"
)
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.1/lib/action_view/path_set.rb:48:in `find'

Which I believe relates to this line here: https://github.com/discourse/discourse/blob/master/app/views/users_email/confirm.html.erb#L36

That references a file that is indeed missing: discourse/app/views/common at main · discourse/discourse · GitHub

8 Likes