Show ShowTokenModal after account creation
This commit is contained in:
@@ -523,6 +523,11 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
||||
|
||||
await acc.save();
|
||||
Toaster.success("Success", 'Successfully Created a new account');
|
||||
|
||||
showDialog<void>(
|
||||
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<AccountRootPage> {
|
||||
void _showTokenModal(BuildContext context, AppAuth acc) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => ShowTokenModal(account: acc),
|
||||
builder: (context) => ShowTokenModal(account: acc, isAfterRegister: false),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user