Merge branch 'UI_Windows' of https://codefirst.iut.uca.fr/git/ConsEcoTeam/ConsEco into UI_Windows
continuous-integration/drone/push Build is passing Details

UI_Windows
Nicolas MAYE 2 years ago
commit 00be26cd44

@ -1,6 +1,7 @@
using IHM.Desktop; using IHM.Desktop;
using IHM.Mobile; using IHM.Mobile;
using Model; using Model;
using ForgetPassword = IHM.Desktop.ForgetPassword;
namespace IHM namespace IHM
{ {
@ -11,11 +12,13 @@ namespace IHM
public AppShellDesktop() public AppShellDesktop()
{ {
InitializeComponent(); InitializeComponent();
Routing.RegisterRoute("ForgetPassword", typeof(ForgetPassword));
} }
} }
} }

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Desktop.ForgetPassword"
Title="ForgetPassword">
<VerticalStackLayout
Margin="20"
Padding="30">
<Label
Text="Rentrée votre adresse email :"
HorizontalOptions="Center" />
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7" Margin="40">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="Email"
x:Name="EntryMail"/>
</Border>
<Button
x:Name="ConnexionButton"
Text="valider Email"
Clicked="SearchEmail"
HorizontalOptions="Center" />
<VerticalStackLayout x:Name="ValidateReceptCode" IsVisible="false" Margin="20">
<Label Text="Veuillez rentrer le code à 6 chiffres reçus par mail"
HorizontalOptions="Center"/>
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7" Margin="40">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="6 Chiffres"
Keyboard="Numeric"
x:Name="EntryCodeRecept"/>
</Border>
<Button
x:Name="ValidationButton"
Text="valider"
Clicked="ValideCode"
HorizontalOptions="Center" />
</VerticalStackLayout>
</VerticalStackLayout>
</ContentPage>

@ -0,0 +1,68 @@
using Model;
using Email = Model.Email;
namespace IHM.Desktop;
public partial class ForgetPassword : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
private string code;
//private DateTime _startTime;
//private CancellationTokenSource _cancellationTokenSource;
public ForgetPassword()
{
InitializeComponent();
}
public void SearchEmail(object sender, EventArgs e)
{
if (EntryMail.Text == null)
{
AffichError("Email inconnue", "Aucun compte existant portant cette adresse mail", "OK");
}
if (Mgr.existEmail(EntryMail.Text))
{
Random generator = new Random();
code = generator.Next(0, 1000000).ToString("D6");
Email.CreateMail(EntryMail.Text, code);
ValidateReceptCode.IsVisible = true;
ConnexionButton.IsEnabled = false;
UpdateArc();
}
}
private async void AffichError(string s, string s1, string s2)
{
await DisplayAlert(s, s1, s2);
}
private async void UpdateArc()
{
int timeRemaining = 60;
while (timeRemaining != 0)
{
ConnexionButton.Text = $"{timeRemaining}";
timeRemaining--;
await Task.Delay(1000);
}
ConnexionButton.Text = "valider Email";
ConnexionButton.IsEnabled = true;
}
private void ValideCode(object sender, EventArgs e)
{
if (EntryCodeRecept.Text == code)
{
NavigateTo();
}
else
{
AffichError("Code non identique", "Veuillez entrer le même code que celui reçu par mail", "OK");
}
}
public async void NavigateTo()
{
//await Navigation.PushModalAsync(new ForgetPassword(EntryMail.Text));
}
}

@ -93,6 +93,9 @@
<MauiXaml Update="Desktop\DashBoard.xaml"> <MauiXaml Update="Desktop\DashBoard.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Desktop\ForgetPassword.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Desktop\Inscription.xaml"> <MauiXaml Update="Desktop\Inscription.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>

Loading…
Cancel
Save