Some checks failed
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/bump_version Pipeline failed
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
61 lines
1.8 KiB
Dart
61 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:pweb/pages/2fa/error_message.dart';
|
|
import 'package:pweb/pages/2fa/input.dart';
|
|
import 'package:pweb/pages/2fa/prompt.dart';
|
|
import 'package:pweb/pages/2fa/resend.dart';
|
|
import 'package:pweb/providers/two_factor.dart';
|
|
|
|
import 'package:pweb/generated/i18n/app_localizations.dart';
|
|
|
|
|
|
class TwoFactorCodePage extends StatelessWidget {
|
|
final VoidCallback onVerificationSuccess;
|
|
|
|
const TwoFactorCodePage({
|
|
super.key,
|
|
required this.onVerificationSuccess,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Consumer<TwoFactorProvider>(
|
|
builder: (context, provider, child) {
|
|
if (provider.verificationSuccess) {
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
onVerificationSuccess();
|
|
});
|
|
}
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('')),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
const TwoFactorPromptText(),
|
|
const SizedBox(height: 32),
|
|
TwoFactorCodeInput(
|
|
onCompleted: (code) => provider.submitCode(code),
|
|
),
|
|
const SizedBox(height: 24),
|
|
if (provider.isSubmitting)
|
|
const Center(child: CircularProgressIndicator())
|
|
else
|
|
const ResendCodeButton(),
|
|
if (provider.hasError) ...[
|
|
const SizedBox(height: 12),
|
|
ErrorMessage(error: AppLocalizations.of(context)!.twoFactorError),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|