feat: 增强邮箱登录功能和密码恢复流程
- 更新邮箱登录相关功能,新增邮箱验证码获取和登录API端点。 - 添加AccountModel以管理用户认证信息,支持会话票据的存储和更新。 - 实现密码恢复功能,支持通过邮箱获取验证码和重置密码。 - 增加本地化支持,更新相关字符串以适应新功能。 - 引入ValidationHelper以验证邮箱和密码格式,确保用户输入的有效性。 - 更新视图以支持邮箱登录和密码恢复的用户交互。
This commit is contained in:
@@ -3,6 +3,7 @@ import ComposableArchitecture
|
||||
|
||||
struct AppRootView: View {
|
||||
@State private var shouldShowMainApp = false
|
||||
@State private var shouldShowHomePage = false
|
||||
|
||||
let splashStore = Store(
|
||||
initialState: SplashFeature.State()
|
||||
@@ -16,9 +17,19 @@ struct AppRootView: View {
|
||||
LoginFeature()
|
||||
}
|
||||
|
||||
let homeStore = Store(
|
||||
initialState: HomeFeature.State()
|
||||
) {
|
||||
HomeFeature()
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if shouldShowMainApp {
|
||||
if shouldShowHomePage {
|
||||
// 主页
|
||||
HomeView(store: homeStore)
|
||||
.transition(.opacity.animation(.easeInOut(duration: 0.5)))
|
||||
} else if shouldShowMainApp {
|
||||
// 登录界面
|
||||
LoginView(store: loginStore)
|
||||
.transition(.opacity.animation(.easeInOut(duration: 0.5)))
|
||||
@@ -31,11 +42,25 @@ struct AppRootView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .ticketSuccess)) { _ in
|
||||
// Ticket 获取成功,切换到主页
|
||||
withAnimation(.easeInOut(duration: 0.5)) {
|
||||
shouldShowHomePage = true
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .homeLogout)) { _ in
|
||||
// 从主页登出,返回登录页面
|
||||
withAnimation(.easeInOut(duration: 0.5)) {
|
||||
shouldShowHomePage = false
|
||||
shouldShowMainApp = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Notification.Name {
|
||||
static let splashFinished = Notification.Name("splashFinished")
|
||||
static let ticketSuccess = Notification.Name("ticketSuccess")
|
||||
}
|
||||
|
||||
#Preview {
|
||||
|
Reference in New Issue
Block a user