43 lines
1.7 KiB
Dart
43 lines
1.7 KiB
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'auth_failure.freezed.dart';
|
|
|
|
/// Grund einer abgelehnten Passwortstärke (`weak_password.reasons`).
|
|
enum WeakPasswordReason { length, characters, pwned, unknown }
|
|
|
|
/// Grund einer serverseitig abgelehnten Registrierung (Trigger-Meldung).
|
|
///
|
|
/// Nur zum Loggen und für Zusatzhinweise: Das Format der Meldung ist nicht
|
|
/// zugesichert (Spec #1 § 4.4), unbekannte Meldungen ergeben [unknown].
|
|
enum RegistrationRejectionReason {
|
|
displayName,
|
|
ageConfirmation,
|
|
termsAcceptance,
|
|
termsVersion,
|
|
unknown,
|
|
}
|
|
|
|
/// Fachliche Fehler der Auth-Abläufe (Mapping: Spec #1 § 4.4).
|
|
@freezed
|
|
sealed class AuthFailure with _$AuthFailure {
|
|
const factory AuthFailure.invalidCredentials() = InvalidCredentials;
|
|
const factory AuthFailure.emailNotConfirmed() = EmailNotConfirmed;
|
|
|
|
/// `over_email_send_rate_limit`. Wo die Adresse frei eingegeben wird, wird
|
|
/// das wie Erfolg behandelt (F12), siehe `resendFailureFor`.
|
|
const factory AuthFailure.emailSendLimited() = EmailSendLimited;
|
|
|
|
/// `over_request_rate_limit` und sonstiges HTTP 429.
|
|
const factory AuthFailure.rateLimited() = RateLimited;
|
|
const factory AuthFailure.weakPassword(List<WeakPasswordReason> reasons) =
|
|
WeakPassword;
|
|
const factory AuthFailure.samePassword() = SamePassword;
|
|
const factory AuthFailure.linkInvalidOrExpired() = LinkInvalidOrExpired;
|
|
const factory AuthFailure.invalidEmail() = InvalidEmail;
|
|
const factory AuthFailure.registrationRejected({
|
|
@Default(RegistrationRejectionReason.unknown)
|
|
RegistrationRejectionReason reason,
|
|
}) = RegistrationRejected;
|
|
const factory AuthFailure.network() = NetworkFailure;
|
|
const factory AuthFailure.unexpected() = Unexpected;
|
|
}
|