diff --git a/MangaMap/App.xaml.cs b/MangaMap/App.xaml.cs index f247bfb..f852825 100644 --- a/MangaMap/App.xaml.cs +++ b/MangaMap/App.xaml.cs @@ -18,7 +18,7 @@ public partial class App : Application MyManager.Admins.Add(MyAdmin); MainPage = new AppShell(); - MyManager.Persistance = new DataContract(); + //MyManager.Persistance = new DataContract(); MyManager.sauvegarder(); } diff --git a/MangaMap/AppShell.xaml.cs b/MangaMap/AppShell.xaml.cs index 9bfc011..1bc5380 100644 --- a/MangaMap/AppShell.xaml.cs +++ b/MangaMap/AppShell.xaml.cs @@ -8,6 +8,7 @@ public partial class AppShell : Shell { InitializeComponent(); + Routing.RegisterRoute("homePageDisconnectdetails", typeof(homePageDisconnect)); Routing.RegisterRoute("homePagedetails", typeof(homePage)); Routing.RegisterRoute("inscriptionPagedetails", typeof(signUpPage)); Routing.RegisterRoute("connexionPagedetails", typeof(loginPage)); diff --git a/MangaMap/MangaMap.csproj b/MangaMap/MangaMap.csproj index a7fd0ae..155678b 100644 --- a/MangaMap/MangaMap.csproj +++ b/MangaMap/MangaMap.csproj @@ -1,111 +1,3 @@ -<<<<<<< HEAD - - - - net7.0; - $(TargetFrameworks);net7.0-windows10.0.19041.0 - - - Exe - MangaMap - true - true - enable - - - MangaMap - - - com.companyname.mangamap - 61196d0c-418f-4fb6-8dc5-c920275e1035 - - - 1.0 - 1 - - 11.0 - 13.1 - 21.0 - 10.0.17763.0 - 10.0.17763.0 - 6.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CustomHeader.xaml - - - signUpPage.xaml - - - - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - - -=======  @@ -157,18 +49,18 @@ - - - - - - + + + + + + - - - + + + @@ -176,43 +68,42 @@ - - CustomHeader.xaml - - - signUpPage.xaml - + + CustomHeader.xaml + + + signUpPage.xaml + - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + - ->>>>>>> Mathéo + \ No newline at end of file diff --git a/MangaMap/Stub/DataContract.cs b/MangaMap/Stub/DataContract.cs index f2d0f3e..f001333 100644 --- a/MangaMap/Stub/DataContract.cs +++ b/MangaMap/Stub/DataContract.cs @@ -41,32 +41,17 @@ namespace MangaMap.Stub var serializer = new DataContractSerializer(typeof(DataToPersist)); DataToPersist data; - if (File.Exists(Path.Combine(FilePath, FileName))) - { + /*if (File.Exists(Path.Combine(FilePath, FileName))) + {*/ using (Stream s = File.OpenRead(Path.Combine(FilePath, FileName))) { data = serializer.ReadObject(s) as DataToPersist; - } + }/* } else { data = new DataToPersist(); - } - - // Vérifier si un utilisateur avec le même nom d'utilisateur existe déjà - var existingUser = data.Utilisateurs.FirstOrDefault(user => user.Pseudo == u.Last().Pseudo); - if (existingUser != null) - { - // Mettre à jour l'utilisateur existant - existingUser.MotDePasse = u.Last().MotDePasse; - existingUser.Email = u.Last().Email; - - } - else - { - // Ajouter le nouvel utilisateur à la liste existante - data.Utilisateurs.Add(u.Last()); - } + }*/ var settings = new XmlWriterSettings() { Indent = true }; using (TextWriter tw = File.CreateText(Path.Combine(FilePath, FileName))) diff --git a/MangaMap/Views/loginPage.xaml.cs b/MangaMap/Views/loginPage.xaml.cs index b69c351..a58a429 100644 --- a/MangaMap/Views/loginPage.xaml.cs +++ b/MangaMap/Views/loginPage.xaml.cs @@ -5,8 +5,9 @@ using MangaMap.Stub; using MangaMap.Model; public partial class loginPage : ContentPage - { + public Manager my_manager => (App.Current as App).MyManager; + public loginPage() { InitializeComponent(); @@ -32,27 +33,15 @@ public partial class loginPage : ContentPage return; } - // Charger les données à partir de la persistance - IPersistanceManager persistanceManager = new DataContract(); - (List oeuvres, List utilisateurs) = persistanceManager.chargeDonne(); - // Vérifier que l'utilisateur existe - Utilisateur utilisateur = utilisateurs.FirstOrDefault(u => u.Email == email && u.MotDePasse == password); + Utilisateur utilisateur = my_manager.Utilisateurs.FirstOrDefault(u => u.Email == email && u.MotDePasse == password); if (utilisateur == null) { -<<<<<<< HEAD await DisplayAlert("Erreur", "Le mot de passe entré est incorrect.", "OK"); return; } - // Redirection vers la page suivante si le mot de passe est correct -======= - await DisplayAlert("Erreur", "L'e-mail ou le mot de passe est incorrect.", "OK"); - return; - } - // Rediriger l'utilisateur vers la page principale ->>>>>>> Mathéo await Navigation.PushAsync(new homePage()); } diff --git a/MangaMap/Views/signUpPage.xaml.cs b/MangaMap/Views/signUpPage.xaml.cs index 29a68fd..b8e5f04 100644 --- a/MangaMap/Views/signUpPage.xaml.cs +++ b/MangaMap/Views/signUpPage.xaml.cs @@ -2,6 +2,7 @@ namespace MangaMap.Views; using MangaMap.Model; using System.Text.RegularExpressions; +using static System.Runtime.InteropServices.JavaScript.JSType; public partial class signUpPage : ContentPage { @@ -24,6 +25,14 @@ public partial class signUpPage : ContentPage string password = passwordEntry.Text; string confirmPassword = confirmPasswordEntry.Text; + foreach (Utilisateur u in my_manager.Utilisateurs) + { + if (u.Email == email ||u.Pseudo==pseudo) + { + await DisplayAlert("Erreur", "L'utilisateur existe déjà.", "OK"); + return; + } + } if (string.IsNullOrWhiteSpace(email) || string.IsNullOrWhiteSpace(password) || string.IsNullOrWhiteSpace(confirmPassword)) @@ -66,8 +75,6 @@ public partial class signUpPage : ContentPage await Navigation.PushAsync(new homePage()); return; } - - } bool IsPasswordStrong(string password)