fix for resend, cooldown and a few small fixes
This commit is contained in:
@@ -12,6 +12,7 @@ import 'package:pweb/pages/verification/controller.dart';
|
||||
import 'package:pweb/pages/verification/resend_dialog.dart';
|
||||
import 'package:pweb/utils/snackbar.dart';
|
||||
import 'package:pweb/utils/error/snackbar.dart';
|
||||
import 'package:pweb/widgets/resend_link.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
@@ -64,6 +65,12 @@ class AccountVerificationContentState
|
||||
Widget content;
|
||||
if (controller.isLoading) {
|
||||
content = const Center(child: CircularProgressIndicator());
|
||||
} else if (controller.isAlreadyVerified) {
|
||||
content = StatusPageSuccess(
|
||||
successMessage: locs.accountAlreadyVerified,
|
||||
successDescription: locs.accountAlreadyVerifiedDescription,
|
||||
action: action,
|
||||
);
|
||||
} else if (controller.isSuccess) {
|
||||
content = StatusPageSuccess(
|
||||
successMessage: locs.accountVerified,
|
||||
@@ -78,18 +85,11 @@ class AccountVerificationContentState
|
||||
exception:
|
||||
controller.error ?? Exception(locs.accountVerificationFailed),
|
||||
action: controller.canResend
|
||||
? OutlinedButton.icon(
|
||||
onPressed: controller.isResending
|
||||
? null
|
||||
: _resendVerificationEmail,
|
||||
icon: controller.isResending
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.mark_email_unread_outlined),
|
||||
label: Text(locs.signupConfirmationResend),
|
||||
? ResendLink(
|
||||
label: locs.signupConfirmationResend,
|
||||
onPressed: _resendVerificationEmail,
|
||||
isDisabled: !controller.canResend || controller.isResending,
|
||||
isLoading: controller.isResending,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
@@ -108,4 +108,4 @@ class AccountVerificationContentState
|
||||
child: content,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ class AccountVerificationController extends ChangeNotifier {
|
||||
Exception? get error => _verificationProvider.error;
|
||||
bool get canResend => _verificationProvider.canResendVerification;
|
||||
bool get isResending => _resendStatus == FlowStatus.resending;
|
||||
bool get isAlreadyVerified => _verificationProvider.isTokenAlreadyUsed;
|
||||
|
||||
void startVerification(String token) {
|
||||
final trimmed = token.trim();
|
||||
|
||||
Reference in New Issue
Block a user