parent
cd90803e9c
commit
dcdfe59a6e
@ -1,38 +1,42 @@
|
||||
using Microsoft.Maui.Graphics;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Stim;
|
||||
|
||||
public partial class Create : ContentPage
|
||||
{
|
||||
public Create()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
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 (((App)App.Current).Manager.SearchUser(Username.Text) == null)
|
||||
{
|
||||
Regex 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);
|
||||
Application.Current.MainPage = new AppShell();
|
||||
await Shell.Current.GoToAsync("//MainPage");
|
||||
}
|
||||
else Error.Children.Add(new Label { Text = "Mot de passe invalide, votre mot de passe doit contenir une Majuscule, une minuscule, un chiffre et faire au moins 8 caractères", TextColor = Colors.Red, VerticalTextAlignment = TextAlignment.Start });
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Stim;
|
||||
|
||||
public partial class Create : ContentPage
|
||||
{
|
||||
public Create()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
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 (((App)App.Current).Manager.SearchUser(Username.Text) == null)
|
||||
{
|
||||
Regex 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);
|
||||
Application.Current.MainPage = new AppShell();
|
||||
await Shell.Current.GoToAsync("//MainPage");
|
||||
}
|
||||
else Error.Children.Add(new Label { Text = "Mot de passe invalide, votre mot de passe doit contenir une Majuscule, une minuscule, un chiffre et faire au moins 8 caractères", TextColor = Colors.Red, VerticalTextAlignment = TextAlignment.Start });
|
||||
rg = new Regex("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$");
|
||||
/*if ( rg.IsMatch )
|
||||
{
|
||||
|
||||
}*/
|
||||
}
|
||||
else Error.Children.Add(new Label { Text = "Ce nom d'utilisateur est déjà pris", TextColor = Colors.Red, VerticalTextAlignment = TextAlignment.Start });
|
||||
}
|
||||
else Error.Children.Add(new Label { Text = "Champs vides", TextColor = Colors.Red, VerticalTextAlignment = TextAlignment.Start });
|
||||
}
|
||||
private void Se_connecter(object sender, EventArgs e)
|
||||
else Error.Children.Add(new Label { Text = "Ce nom d'utilisateur est déjà pris", TextColor = Colors.Red, VerticalTextAlignment = TextAlignment.Start });
|
||||
}
|
||||
else Error.Children.Add(new Label { Text = "Champs vides", TextColor = Colors.Red, VerticalTextAlignment = TextAlignment.Start });
|
||||
}
|
||||
private void Se_connecter(object sender, EventArgs e)
|
||||
{
|
||||
//Ca ça marche pas faut une autre commande, Marc svp aide moi
|
||||
Application.Current.MainPage = new LoginPage();
|
||||
}
|
||||
Application.Current.MainPage = new LoginPage();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue