Show ShowTokenModal after account creation
This commit is contained in:
@@ -523,6 +523,11 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
|||||||
|
|
||||||
await acc.save();
|
await acc.save();
|
||||||
Toaster.success("Success", 'Successfully Created a new account');
|
Toaster.success("Success", 'Successfully Created a new account');
|
||||||
|
|
||||||
|
showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => ShowTokenModal(account: acc, isAfterRegister: true),
|
||||||
|
);
|
||||||
} catch (exc, trace) {
|
} catch (exc, trace) {
|
||||||
ApplicationLog.error('Failed to create user account: ' + exc.toString(), trace: trace);
|
ApplicationLog.error('Failed to create user account: ' + exc.toString(), trace: trace);
|
||||||
Toaster.error("Error", 'Failed to create user account');
|
Toaster.error("Error", 'Failed to create user account');
|
||||||
@@ -737,7 +742,7 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
|||||||
void _showTokenModal(BuildContext context, AppAuth acc) {
|
void _showTokenModal(BuildContext context, AppAuth acc) {
|
||||||
showDialog<void>(
|
showDialog<void>(
|
||||||
context: context,
|
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 {
|
class ShowTokenModal extends StatelessWidget {
|
||||||
final AppAuth account;
|
final AppAuth account;
|
||||||
|
final bool isAfterRegister;
|
||||||
|
|
||||||
const ShowTokenModal({
|
const ShowTokenModal({Key? key, required this.account, required this.isAfterRegister}) : super(key: key);
|
||||||
Key? key,
|
|
||||||
required this.account,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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(
|
return AlertDialog(
|
||||||
title: const Text('UserID + Token'),
|
title: const Text('UserID & Token'),
|
||||||
content: Container(
|
content: Container(
|
||||||
width: 9000,
|
width: 9000,
|
||||||
height: 400,
|
height: 450,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
const BadgeDisplay(
|
BadgeDisplay(
|
||||||
text: "Use your UserID and Send-Token to send messages to your account.\n\nThe Admin-Token should not be shared.",
|
text: alertText,
|
||||||
icon: null,
|
icon: null,
|
||||||
mode: BadgeMode.warn,
|
mode: BadgeMode.info,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
if (this.account.userID != null)
|
if (this.account.userID != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user