Phase 2 aus dem Native-Auth-Vollausbau-Plan (Option A, siehe ../mana/docs/MANA_SWIFT.md). Entstanden weil drei Apps fast- byte-identische LoginView.swift hatten und Sign-Up/Forgot-PW komplett fehlten. ManaAuthUI-Library mit: - ManaBrandConfig — App-injizierte Theme-Werte (forest für Cards/ Manaspur, mana-default für Memoro), Environment-Key, View-Modifier - Base-Components: ManaAuthScaffold, ManaPrimaryButton, ManaTextField, ManaSecureField + .manaEmailField()-Modifier - ManaLoginView + LoginViewModel — Email/PW-Login, schaltet bei AuthError.emailNotVerified automatisch auf ManaEmailVerifyGateView - ManaSignUpView + SignUpViewModel — Email/Name/PW + awaiting- Verification-Hinweis-Screen - ManaEmailVerifyGateView + ViewModel — Resend-Verification - ManaForgotPasswordView + ViewModel — Reset-Mail anfordern (immer generischer Hinweis, User-Enumeration-Schutz) - ManaResetPasswordView + ViewModel — neues PW mit Token aus Universal-Link - ManaChangeEmailView, ManaChangePasswordView, ManaDeleteAccountView + internal ViewModels — Account-Bausteine - ManaDeleteAccountView ist zweistufig (Bestätigungs-Wort tippen + Passwort) → App-Store-Guideline 5.1.1(v) Pflicht-Surface 26/26 ViewModel-Tests grün via per-test-ID URLProtocol-Routing (löst Parallel-Pollution zwischen .serialized Suites). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
83 lines
2.9 KiB
Swift
83 lines
2.9 KiB
Swift
import ManaCore
|
|
import SwiftUI
|
|
|
|
/// Wird angezeigt, wenn ein Login-Versuch mit
|
|
/// ``AuthError/emailNotVerified`` gescheitert ist. Bietet einen
|
|
/// Resend-Mail-Button und einen "Zurück zum Login"-Pfad.
|
|
///
|
|
/// Die Apps bauen das nicht direkt ein — ``ManaLoginView`` schaltet
|
|
/// automatisch um wenn der Sign-In den entsprechenden Fehler liefert.
|
|
public struct ManaEmailVerifyGateView: View {
|
|
@Environment(\.manaBrand) private var brand
|
|
|
|
@State private var model: EmailVerifyGateViewModel
|
|
private let onBackToLogin: () -> Void
|
|
|
|
public init(
|
|
email: String,
|
|
auth: AuthClient,
|
|
sourceAppUrl: URL? = nil,
|
|
onBackToLogin: @escaping () -> Void
|
|
) {
|
|
_model = State(initialValue: EmailVerifyGateViewModel(
|
|
email: email,
|
|
auth: auth,
|
|
sourceAppUrl: sourceAppUrl
|
|
))
|
|
self.onBackToLogin = onBackToLogin
|
|
}
|
|
|
|
public var body: some View {
|
|
ManaAuthScaffold {
|
|
VStack(spacing: 16) {
|
|
Image(systemName: "envelope.badge")
|
|
.font(.system(size: 56, weight: .light))
|
|
.foregroundStyle(brand.primary)
|
|
.padding(.bottom, 8)
|
|
|
|
Text("Bestätige deine Email")
|
|
.font(.title2)
|
|
.fontWeight(.semibold)
|
|
.foregroundStyle(brand.foreground)
|
|
.multilineTextAlignment(.center)
|
|
|
|
Text(
|
|
"Wir haben dir eine Bestätigungs-Mail an **\(model.email)** geschickt. "
|
|
+ "Klicke den Link in der Mail, dann kannst du dich anmelden."
|
|
)
|
|
.font(.subheadline)
|
|
.foregroundStyle(brand.mutedForeground)
|
|
.multilineTextAlignment(.center)
|
|
|
|
ManaPrimaryButton(
|
|
"Bestätigungs-Mail erneut senden",
|
|
isLoading: model.isResending,
|
|
isEnabled: model.canResend
|
|
) {
|
|
Task { await model.resend() }
|
|
}
|
|
.padding(.top, 8)
|
|
|
|
switch model.status {
|
|
case let .resent(message):
|
|
Text(message)
|
|
.font(.footnote)
|
|
.foregroundStyle(brand.success)
|
|
.multilineTextAlignment(.center)
|
|
case let .error(message):
|
|
Text(message)
|
|
.font(.footnote)
|
|
.foregroundStyle(brand.error)
|
|
.multilineTextAlignment(.center)
|
|
default:
|
|
EmptyView()
|
|
}
|
|
|
|
Button("Zurück zum Login", action: onBackToLogin)
|
|
.font(.subheadline)
|
|
.foregroundStyle(brand.mutedForeground)
|
|
.padding(.top, 16)
|
|
}
|
|
}
|
|
}
|
|
}
|