Skip to content

Commit f972ba9

Browse files
authored
Feature/v4 (#184)
Fix email validation, xamarin->maui
1 parent a084edf commit f972ba9

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The solution consists of 4 libraries - a base one and 3 platform specific ones:
1212
* FirebaseAuthentication<strong>.net</strong> targets [.NET Standard 2.0](https://github.com/dotnet/standard/blob/master/docs/versions.md)
1313
* FirebaseAuthentication<strong>.WPF</strong> targets [WPF on .NET 6](https://github.com/dotnet/wpf)
1414
* FirebaseAuthentication<strong>.UWP</strong> targets [UWP with min version 19041](https://docs.microsoft.com/en-us/windows/uwp/updates-and-versions/choose-a-uwp-version)
15-
* FirebaseAuthentication<strong>.Xamarin</strong> targets Xamarin.Forms (*TODO*)
15+
* FirebaseAuthentication<strong>.Maui</strong> targets Maui (*TODO*)
1616

1717
## Installation
1818

@@ -25,7 +25,7 @@ dotnet add package FirebaseAuthentication.net
2525
# Platform specific FirebaseUI (has dependency on base package)
2626
dotnet add package FirebaseAuthentication.WPF
2727
dotnet add package FirebaseAuthentication.UWP
28-
dotnet add package FirebaseAuthentication.Xamarin
28+
dotnet add package FirebaseAuthentication.Maui
2929
```
3030

3131
Use the `--version` option to specify a [preview version](https://www.nuget.org/packages/FirebaseAuthentication.net/absoluteLatest) to install.

src/Auth.UI/EmailValidator.cs

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Text.RegularExpressions;
1+
using System;
2+
using System.Net.Mail;
23

34
namespace Firebase.Auth.UI
45
{
@@ -9,9 +10,16 @@ public static class EmailValidator
910
/// </summary>
1011
public static bool ValidateEmail(string email)
1112
{
12-
var regx = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
13-
var match = regx.Match(email);
14-
return match.Success;
13+
try
14+
{
15+
var m = new MailAddress(email);
16+
17+
return true;
18+
}
19+
catch (FormatException)
20+
{
21+
return false;
22+
}
1523
}
1624
}
1725
}

src/Auth/Auth.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ FirebaseUI is supported by platform-specific libraries:
1414

1515
* FirebaseAuthentication.WPF
1616
* FirebaseAuthentication.UWP
17-
* FirebaseAuthentication.Xamarin
17+
* FirebaseAuthentication.Maui
1818
</Description>
1919
<PackageReadmeFile>README.md</PackageReadmeFile>
2020
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>

0 commit comments

Comments
 (0)