From b88a31da923bbc8fd5a5cbcc7fb7a82844dfcfd7 Mon Sep 17 00:00:00 2001 From: Jade_VAN_BRABANDT Date: Tue, 6 Jun 2023 17:56:54 +0200 Subject: [PATCH] =?UTF-8?q?Les=20regexs=20marchent=20pas=20comme=20=C3=A7a?= =?UTF-8?q?=20apparament=20du=20coup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Stim/Create.xaml.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/Stim/Create.xaml.cs b/Sources/Stim/Create.xaml.cs index ebda9ff..b317763 100644 --- a/Sources/Stim/Create.xaml.cs +++ b/Sources/Stim/Create.xaml.cs @@ -12,15 +12,15 @@ public partial class Create : ContentPage private async void Creer_un_compte(object sender, EventArgs e) { Error.Clear(); - if (!(string.IsNullOrWhiteSpace(Username.Text) || string.IsNullOrWhiteSpace(Pswd.Text) || string.IsNullOrWhiteSpace(Email.Text))) + if (!string.IsNullOrWhiteSpace(Username.Text) || !string.IsNullOrWhiteSpace(Pswd.Text) || !string.IsNullOrWhiteSpace(Email.Text)) { if (((App)App.Current).Manager.SearchUser(Username.Text) == null) { - GeneratedRegexAttribute rg = new GeneratedRegexAttribute("^([a-zA-Z0-9_.])+@([a-zA-Z0-9_]+[.])+[a-zA-Z0-9_]{2,}$"); - if (rg.Match(Email.Text)) + Regex rg = new Regex("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$"); + if (rg.IsMatch(Email.Text)) { - rg = new GeneratedRegexAttribute("^(?=.*[A-Za-z])(?=.*[0-9@$!%*#?&])[A-Za-z-0-9@$!%*#?&]{8,}$"); - if (rg.Match(Pswd.Text)) + rg = new Regex("^(?=.*[A-Za-z])(?=.*[0-9@$!%*#?&])[A-Za-z-0-9@$!%*#?&]{8,}$"); + if (rg.IsMatch(Pswd.Text)) { ((App)App.Current).Manager.AddUsertoUserList(new("", Username.Text, "", Email.Text, Pswd.Text)); ((App)App.Current).Manager.CurrentUser = ((App)App.Current).Manager.SearchUser(Username.Text);