Implemented cooldown before User is able to resend confirmation code for 2fa
This commit is contained in:
26
frontend/pshared/lib/api/responses/confirmation.dart
Normal file
26
frontend/pshared/lib/api/responses/confirmation.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'confirmation.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class ConfirmationResponse {
|
||||
@JsonKey(name: 'ttl_seconds', defaultValue: 0)
|
||||
final int ttlSeconds;
|
||||
@JsonKey(name: 'cooldown_seconds', defaultValue: 0)
|
||||
final int cooldownSeconds;
|
||||
@JsonKey(defaultValue: '')
|
||||
final String destination;
|
||||
|
||||
const ConfirmationResponse({
|
||||
required this.ttlSeconds,
|
||||
required this.cooldownSeconds,
|
||||
required this.destination,
|
||||
});
|
||||
|
||||
Duration get cooldownDuration => Duration(seconds: cooldownSeconds);
|
||||
Duration get ttlDuration => Duration(seconds: ttlSeconds);
|
||||
|
||||
factory ConfirmationResponse.fromJson(Map<String, dynamic> json) => _$ConfirmationResponseFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ConfirmationResponseToJson(this);
|
||||
}
|
||||
Reference in New Issue
Block a user