From 8dd7751cecc4fd5b80ec984cd4bf726e9c8e1c40 Mon Sep 17 00:00:00 2001 From: giomfo Date: Wed, 6 Apr 2016 18:51:48 +0200 Subject: [PATCH] BugFix Entering invalid email address into registration gives error saying it's not supported #201 --- Vector/Assets/en.lproj/Vector.strings | 1 + Vector/Views/Authentication/AuthInputsView.m | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/Vector/Assets/en.lproj/Vector.strings b/Vector/Assets/en.lproj/Vector.strings index 32ebca3c6..93e93f50a 100644 --- a/Vector/Assets/en.lproj/Vector.strings +++ b/Vector/Assets/en.lproj/Vector.strings @@ -48,6 +48,7 @@ "auth_invalid_login_param" = "Incorrect username and/or password"; "auth_invalid_user_name" = "User names may only contain letters, numbers, dots, hyphens and underscores"; "auth_invalid_password" = "Password too short (min 6)"; +"auth_invalid_email" = "This doesn't look like a valid email address"; "auth_missing_password" = "Missing password"; "auth_missing_optional_email" = "If you don't specify an email address, you won't be able to reset your password. Are you sure?"; "auth_missing_email" = "Missing email address"; diff --git a/Vector/Views/Authentication/AuthInputsView.m b/Vector/Views/Authentication/AuthInputsView.m index 31767f6f2..48bb28a4d 100644 --- a/Vector/Views/Authentication/AuthInputsView.m +++ b/Vector/Views/Authentication/AuthInputsView.m @@ -191,6 +191,15 @@ NSLog(@"[AuthInputsView] Invalid user name"); errorMsg = NSLocalizedStringFromTable(@"auth_invalid_user_name", @"Vector", nil); } + else if (self.emailTextField.text.length) + { + // Check validity of the non empty email + if ([MXTools isEmailAddress:self.emailTextField.text] == NO) + { + NSLog(@"[AuthInputsView] Invalid email"); + errorMsg = NSLocalizedStringFromTable(@"auth_invalid_email", @"Vector", nil); + } + } } }