Frontend first draft

This commit is contained in:
Arseni
2025-11-13 15:06:15 +03:00
parent e47f343afb
commit ddb54ddfdc
504 changed files with 25498 additions and 1 deletions

View File

@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'package:pweb/services/auth.dart';
class TwoFactorProvider extends ChangeNotifier {
final AuthenticationService _authService;
TwoFactorProvider(this._authService);
bool _isSubmitting = false;
bool _hasError = false;
bool _verificationSuccess = false;
bool get isSubmitting => _isSubmitting;
bool get hasError => _hasError;
bool get verificationSuccess => _verificationSuccess;
Future<void> submitCode(String code) async {
_isSubmitting = true;
_hasError = false;
_verificationSuccess = false;
notifyListeners();
try {
final success = await _authService.verifyTwoFactorCode(code);
if (success) {
_verificationSuccess = true;
}
} catch (e) {
_hasError = true;
} finally {
_isSubmitting = false;
notifyListeners();
}
}
}