diff --git a/Sources/Data/Stub.cs b/Sources/Data/Stub.cs index dcf99c2..b4973f6 100644 --- a/Sources/Data/Stub.cs +++ b/Sources/Data/Stub.cs @@ -4,9 +4,28 @@ namespace Data { public class Stub : IPersistanceManager { + private List lesInscrits = new List(); + + public Stub() + { + lesInscrits.Add(new Inscrit( + "1", + "LIVET", + "livet.hugo2003@gmail.com", + "Hugo", + "Bonjour63." + )); + } public string GetId(string mail) { - return "1"; + foreach(Inscrit i in lesInscrits) + { + if(i.Mail == mail) + { + return i.Id; + } + } + return null; } public void SupprimerInscritBdd(Inscrit inscrit) { @@ -20,22 +39,45 @@ namespace Data { throw new NotImplementedException(); } - public void CreateInscrit(Inscrit inscrit){} + public void CreateInscrit(Inscrit inscrit){ + lesInscrits.Add(inscrit); + } public string LastInscrit() { return "1"; } public bool ExistEmail(string mail) { - return true; + foreach(Inscrit i in lesInscrits) + { + if(i.Mail == mail) + { + return true; + } + } + return false; } public void ChangePasswordBdd(string mail, string newMdp) { - throw new NotImplementedException(); + foreach(Inscrit i in lesInscrits) + { + if(i.Mail == mail) + { + i.Mdp = newMdp; + } + } } public string RecupMdpBdd(string mail) { - return "61202106183104184172149183829180134166241997147151111351903525172892257223616564213999421532841808077145252175106506275806214514321147161111472321892055913517616241"; + Hash hash = new Hash(); + foreach(Inscrit i in lesInscrits) + { + if(i.Mail == mail) + { + return hash.CreateHashCode(i.Mdp); + } + } + return "inexistant"; } public int CalculTotalSoldeComtpe(Inscrit user) { @@ -65,10 +107,14 @@ namespace Data public Inscrit GetInscrit(string mail) { - string mdp = "Azerty12345678!"; - Inscrit i = new Inscrit("1", "LIVET", "livet.hugo2003@gmail.com", "Hugo", mdp); - - return i; + foreach(Inscrit i in lesInscrits) + { + if(i.Mail == mail) + { + return i; + } + } + return null; } public IList GetCompteFromOFX(string ofx) diff --git a/Sources/IHM/Mobile/ForgetPassword.xaml.cs b/Sources/IHM/Mobile/ForgetPassword.xaml.cs index 44361aa..4384043 100644 --- a/Sources/IHM/Mobile/ForgetPassword.xaml.cs +++ b/Sources/IHM/Mobile/ForgetPassword.xaml.cs @@ -28,6 +28,10 @@ public partial class ForgetPassword : ContentPage ConnexionButton.IsEnabled = false; UpdateArc(); } + else + { + AffichError("Mail inexistant", "Aucun compte possédant cette adresse email trouvé", "OK"); + } } private async void AffichError(string s, string s1, string s2) { diff --git a/Sources/Modele/Manager.cs b/Sources/Modele/Manager.cs index 012177c..0ca01b4 100644 --- a/Sources/Modele/Manager.cs +++ b/Sources/Modele/Manager.cs @@ -28,10 +28,7 @@ namespace Model private int solde; - - private Inscrit user; - public Inscrit User { get