diff --git a/lib/pangea/login/pages/create_pangea_account_page.dart b/lib/pangea/login/pages/create_pangea_account_page.dart index cc9e418ce..c5a7b01ff 100644 --- a/lib/pangea/login/pages/create_pangea_account_page.dart +++ b/lib/pangea/login/pages/create_pangea_account_page.dart @@ -131,6 +131,7 @@ class CreatePangeaAccountPageState extends State { } Future _updateTargetLanguage() async { + if (_langCode == null) return; await MatrixState.pangeaController.userController.updateProfile( (profile) { profile.userSettings.targetLanguage = _langCode; @@ -150,7 +151,12 @@ class CreatePangeaAccountPageState extends State { try { if (_langCode == null) { - throw Exception('No language selected'); + // at this point, there's no cached selected language, and couldn't get + // language from cached course code, so go back to the language selection page + if (mounted) { + context.go('/registration'); + } + return; } final updateFuture = [ diff --git a/lib/pangea/login/utils/sso_login_action.dart b/lib/pangea/login/utils/sso_login_action.dart index c552d9008..fa2aac089 100644 --- a/lib/pangea/login/utils/sso_login_action.dart +++ b/lib/pangea/login/utils/sso_login_action.dart @@ -62,7 +62,7 @@ Future pangeaSSOLoginAction( final route = FluffyChatApp.router.state.fullPath; if (route == null || (!route.contains("/rooms") && !route.contains('registration'))) { - context.go('/registration/create'); + context.go('/rooms'); } }, ).timeout(const Duration(seconds: 30)); @@ -77,7 +77,7 @@ Future pangeaSSOLoginAction( final route = FluffyChatApp.router.state.fullPath; if (route == null || (!route.contains("/rooms") && !route.contains('registration'))) { - context.go('/registration/create'); + context.go('/rooms'); } } else { await redirect; diff --git a/lib/pangea/user/controllers/user_controller.dart b/lib/pangea/user/controllers/user_controller.dart index c2d147366..b548be8d4 100644 --- a/lib/pangea/user/controllers/user_controller.dart +++ b/lib/pangea/user/controllers/user_controller.dart @@ -106,6 +106,7 @@ class UserController { Profile Function(Profile) update, { waitForDataInSync = false, }) async { + await initialize(); final prevTargetLang = _pangeaController.languageController.userL2; final prevBaseLang = _pangeaController.languageController.userL1; final prevHash = profile.hashCode;