diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index c701a35f6..b10403ef4 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -189,6 +189,8 @@ "authentication_choose_password_text_field_placeholder" = "New Password"; "authentication_choose_password_signout_all_devices" = "Sign out of all devices"; "authentication_choose_password_submit_button" = "Reset Password"; +"authentication_choose_password_not_verified_title" = "Email not verified"; +"authentication_choose_password_not_verified_message" = "Check your inbox"; "authentication_verify_msisdn_input_title" = "Enter your phone number"; /* The placeholder will show the homeserver's domain */ diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index ae9995406..d1de90bd7 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -543,6 +543,14 @@ public class VectorL10n: NSObject { public static var authenticationChoosePasswordInputTitle: String { return VectorL10n.tr("Vector", "authentication_choose_password_input_title") } + /// Check your inbox + public static var authenticationChoosePasswordNotVerifiedMessage: String { + return VectorL10n.tr("Vector", "authentication_choose_password_not_verified_message") + } + /// Email not verified + public static var authenticationChoosePasswordNotVerifiedTitle: String { + return VectorL10n.tr("Vector", "authentication_choose_password_not_verified_title") + } /// Sign out of all devices public static var authenticationChoosePasswordSignoutAllDevices: String { return VectorL10n.tr("Vector", "authentication_choose_password_signout_all_devices") diff --git a/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordModels.swift b/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordModels.swift index 3e75714e5..6c8230b18 100644 --- a/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordModels.swift +++ b/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordModels.swift @@ -68,6 +68,8 @@ enum AuthenticationChoosePasswordViewAction { enum AuthenticationChoosePasswordErrorType: Hashable { /// An error response from the homeserver. case mxError(String) + /// The user hasn't tapped the link in the verification email. + case emailNotVerified /// An unknown error occurred. case unknown } diff --git a/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordViewModel.swift b/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordViewModel.swift index 97dc9259d..89f418a07 100644 --- a/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordViewModel.swift +++ b/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordViewModel.swift @@ -55,6 +55,10 @@ class AuthenticationChoosePasswordViewModel: AuthenticationChoosePasswordViewMod state.bindings.alertInfo = AlertInfo(id: type, title: VectorL10n.error, message: message) + case .emailNotVerified: + state.bindings.alertInfo = AlertInfo(id: type, + title: VectorL10n.authenticationChoosePasswordNotVerifiedTitle, + message: VectorL10n.authenticationChoosePasswordNotVerifiedMessage) case .unknown: state.bindings.alertInfo = AlertInfo(id: type) } diff --git a/RiotSwiftUI/Modules/Authentication/ChoosePassword/Coordinator/AuthenticationChoosePasswordCoordinator.swift b/RiotSwiftUI/Modules/Authentication/ChoosePassword/Coordinator/AuthenticationChoosePasswordCoordinator.swift index 03a520087..9d02e4000 100644 --- a/RiotSwiftUI/Modules/Authentication/ChoosePassword/Coordinator/AuthenticationChoosePasswordCoordinator.swift +++ b/RiotSwiftUI/Modules/Authentication/ChoosePassword/Coordinator/AuthenticationChoosePasswordCoordinator.swift @@ -136,7 +136,12 @@ final class AuthenticationChoosePasswordCoordinator: Coordinator, Presentable { /// Processes an error to either update the flow or display it to the user. @MainActor private func handleError(_ error: Error) { if let mxError = MXError(nsError: error as NSError) { - authenticationChoosePasswordViewModel.displayError(.mxError(mxError.error)) + if mxError.errcode == kMXErrCodeStringUnauthorized { + authenticationChoosePasswordViewModel.displayError(.emailNotVerified) + } else { + authenticationChoosePasswordViewModel.displayError(.mxError(mxError.error)) + } + return }