diff --git a/flutter/lib/pages/account/account.dart b/flutter/lib/pages/account/account.dart index c16223d..6f8a50e 100644 --- a/flutter/lib/pages/account/account.dart +++ b/flutter/lib/pages/account/account.dart @@ -523,6 +523,11 @@ class _AccountRootPageState extends State { await acc.save(); Toaster.success("Success", 'Successfully Created a new account'); + + showDialog( + context: context, + builder: (context) => ShowTokenModal(account: acc, isAfterRegister: true), + ); } catch (exc, trace) { ApplicationLog.error('Failed to create user account: ' + exc.toString(), trace: trace); Toaster.error("Error", 'Failed to create user account'); @@ -737,7 +742,7 @@ class _AccountRootPageState extends State { void _showTokenModal(BuildContext context, AppAuth acc) { showDialog( context: context, - builder: (context) => ShowTokenModal(account: acc), + builder: (context) => ShowTokenModal(account: acc, isAfterRegister: false), ); } } diff --git a/flutter/lib/pages/account/show_token_modal.dart b/flutter/lib/pages/account/show_token_modal.dart index 594bb14..e5afd8c 100644 --- a/flutter/lib/pages/account/show_token_modal.dart +++ b/flutter/lib/pages/account/show_token_modal.dart @@ -8,27 +8,30 @@ import 'package:simplecloudnotifier/utils/ui.dart'; class ShowTokenModal extends StatelessWidget { final AppAuth account; + final bool isAfterRegister; - const ShowTokenModal({ - Key? key, - required this.account, - }) : super(key: key); + const ShowTokenModal({Key? key, required this.account, required this.isAfterRegister}) : super(key: key); @override Widget build(BuildContext context) { + var alertText = "Use your UserID and Send-Token to send messages to your account.\n\nThe Admin-Token should not be shared."; + if (this.isAfterRegister) { + alertText = "These are your UserID and tokens.\n\nBackup your Admin-Token safely.\n\nUse UserId & Send-Token to send yourself messages."; + } + return AlertDialog( - title: const Text('UserID + Token'), + title: const Text('UserID & Token'), content: Container( width: 9000, - height: 400, + height: 450, child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - const BadgeDisplay( - text: "Use your UserID and Send-Token to send messages to your account.\n\nThe Admin-Token should not be shared.", + BadgeDisplay( + text: alertText, icon: null, - mode: BadgeMode.warn, + mode: BadgeMode.info, ), const SizedBox(height: 16), if (this.account.userID != null)