Skip to content

A platform for community discussion. Free, open, simple.

FIX: 2fa check error for anon users (#27924)

David Taylor0b7099f34e22
diff --git a/app/assets/javascripts/discourse/app/services/restricted-routing.js b/app/assets/javascripts/discourse/app/services/restricted-routing.js
index 133308698c4..998c988374a 100644
--- a/app/assets/javascripts/discourse/app/services/restricted-routing.js
+++ b/app/assets/javascripts/discourse/app/services/restricted-routing.js
@@ -43,7 +43,7 @@ export default class RestrictedRouting extends Service {
// methods in ApplicationController.
const enforcing2fa =
(this.siteSettings.enforce_second_factor === "staff" &&
- this.currentUser.staff) ||
+ this.currentUser?.staff) ||
this.siteSettings.enforce_second_factor === "all";
const exemptedFrom2faEnforcement =