From 16ddaea9d55bb69ca1a51b4d902836abc11de9db Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Thu, 16 Oct 2025 09:27:44 -0400 Subject: [PATCH] fix: if a new user gets to account create page without target language in local storage or from course, direct them back to language selection (#4422) --- .../login/pages/create_pangea_account_page.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/pangea/login/pages/create_pangea_account_page.dart b/lib/pangea/login/pages/create_pangea_account_page.dart index 7814ada55..e199c2d12 100644 --- a/lib/pangea/login/pages/create_pangea_account_page.dart +++ b/lib/pangea/login/pages/create_pangea_account_page.dart @@ -165,8 +165,17 @@ class CreatePangeaAccountPageState extends State { } try { - final targetLangCode = await _targetLangCode; final baseLangCode = await _baseLangCode; + final targetLangCode = await _targetLangCode; + + // User's L2 is not set and they niether have a target language in their + // local storage nor can they get it from a course they plan to join. + // Redirect back to language selection. + // This can happen if a user creates a new account via login => SSO + if (targetLangCode == null) { + context.go('/registration'); + } + final updateFuture = [ _setAvatar(), MatrixState.pangeaController.userController.updateProfile(