You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.8 KiB
62 lines
1.8 KiB
using Model;
|
|
using System.Windows.Input;
|
|
|
|
namespace IHM.Mobile
|
|
{
|
|
public partial class MainPage : ContentPage
|
|
{
|
|
public Manager Mgr => (App.Current as App).Manager;
|
|
public MainPage()
|
|
{
|
|
InitializeComponent();
|
|
//BindingContext = this;
|
|
}
|
|
|
|
|
|
|
|
public void ConnectionOnClicked(object sender, EventArgs e)
|
|
{
|
|
if (EntryMail.Text == null || EntryPassworld.Text == null)
|
|
{
|
|
AffichError("Champ invalide", "Veuillez compléter tout les champs", "OK");
|
|
}
|
|
else {
|
|
if (Mgr.Pers.EmailDisponible(EntryMail.Text))
|
|
{
|
|
if (Mgr.CompareHash(Mgr.getPassword(EntryMail.Text), EntryPassworld.Text))
|
|
{
|
|
Mgr.createUser(EntryMail.Text);
|
|
ConnexionValide();
|
|
}
|
|
else
|
|
{
|
|
AffichError("Mot de passe non valide", "Le mot de passe ne correspond pas à celui existant pout cette adresse mail", "OK");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AffichError("Compte inexistant", "Email ou mot de passe invalide", "OK");
|
|
}
|
|
}
|
|
}
|
|
|
|
private async void ConnexionValide()
|
|
{
|
|
Mgr.LoadBanques();
|
|
await Navigation.PopModalAsync();
|
|
}
|
|
|
|
private async void AffichError(string s, string s1, string s2)
|
|
{
|
|
await DisplayAlert(s, s1, s2);
|
|
}
|
|
|
|
protected override bool OnBackButtonPressed()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public ICommand TapCommand => new Command<string>(async (page) => await Shell.Current.GoToAsync(page));
|
|
|
|
}
|
|
} |