Ajout de la vue forgetPassword pour les vues windows
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
a8d240dc6e
commit
8f38c138d4
@ -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));
|
||||
}
|
||||
}
|
Loading…
Reference in new issue