Added backend for signUpPage

pull/1/head
Matheo HERSAN 2 years ago
parent 9e725df849
commit a5d9263fa4

@ -1,4 +1,5 @@
using System; using MangaMap.Views;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -6,11 +7,18 @@ using System.Threading.Tasks;
namespace MangaMap.Model namespace MangaMap.Model
{ {
class Admin public class Admin : Personne
{ {
public Admin(string mdp, string email, string pseudo) : base(mdp, email, pseudo)
{
}
public int Id { get; private set; } public int Id { get; private set; }
public Admin(int id)
{ this.Id = id; }
public void ajouterAnime() { }
public void supprimerAnime() { }
} }
} }

@ -9,13 +9,13 @@ namespace MangaMap.Model
class Oeuvre class Oeuvre
{ {
public string Nom { get; private set; } public string Nom { get; private set; }
public string[] Genre { get; private set; } public List <string> Genre { get; private set; }
public string Type { get; private set; } public string Type { get; private set; }
public string Description { get; private set; } public string Description { get; private set; }
public int Note { get; private set; } public int Note { get; private set; }
public int NbEpisodes { get; private set; } public int NbEpisodes { get; private set; }
public Oeuvre(string nom, string[] genre, string type, string description, int note, int nbEpisode) public Oeuvre(string nom, List<string> genre, string type, string description, int note, int nbEpisode)
{ {
Nom = nom; Nom = nom;
Genre = genre; Genre = genre;

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace MangaMap.Model namespace MangaMap.Model
{ {
class Personne public class Personne
{ {
public string MotDePasse { get; private set; } public string MotDePasse { get; private set; }
public string Email { get; private set; } public string Email { get; private set; }
@ -62,5 +62,9 @@ namespace MangaMap.Model
return false; return false;
} }
} }
} }

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace MangaMap.Model namespace MangaMap.Model
{ {
class Utilisateur public class Utilisateur
{ {
public string nom { get; private set; } public string nom { get; private set; }
public string prenom { get; private set; } public string prenom { get; private set; }

@ -3,10 +3,13 @@
x:Class="MangaMap.Views.listPage" x:Class="MangaMap.Views.listPage"
BackgroundColor="Black"> BackgroundColor="Black">
<ScrollView>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Text="Watching" TextColor="White" FontSize="Title" Margin="50,10,0,0" Grid.Row="0"/> <Label Text="Watching" TextColor="White" FontSize="Title" Margin="50,10,0,0" Grid.Row="0"/>
@ -85,6 +88,84 @@
</Grid> </Grid>
</Frame> </Frame>
<Label Text="Completed" TextColor="White" FontSize="Title" Margin="50,10,0,0" Grid.Row="2"/>
<Frame Grid.Row="3" BackgroundColor="Black" Margin="20" BorderColor="Black">
<Grid BackgroundColor="#333333" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Margin="20" Grid.Row="0" ColumnDefinitions="*,300,300">
<Label Grid.Column="0"
Text="Titre" FontSize="Large" TextColor="White"
HorizontalOptions="Start" VerticalOptions="Center"/>
<Label Grid.Column="1"
Text="Score" FontSize="Large" TextColor="White"
HorizontalOptions="Center" VerticalOptions="Center"/>
<Label Grid.Column="2"
Text="Progression" FontSize="Large" TextColor="White"
HorizontalOptions="End" VerticalOptions="Center"/>
</Grid> </Grid>
<ScrollView Grid.Row="3" VerticalScrollBarVisibility="Always">
<VerticalStackLayout Spacing="10">
<Grid Margin="20,0,20,0" ColumnDefinitions="*,*,300,300">
<Rectangle Grid.Column="0" Fill="#FFFFFF" WidthRequest="100" HeightRequest="100" HorizontalOptions="Start"/>
<Label Grid.Column="1" Text="Test Titre" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="3" Text="10/85" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
<Grid Margin="20,0,20,0" ColumnDefinitions="*,*,300,300">
<Rectangle Grid.Column="0" Fill="Blue" WidthRequest="100" HeightRequest="100" HorizontalOptions="Start"/>
<Label Grid.Column="1" Text="Test Titre" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="3" Text="10/85" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
<Grid Margin="20,0,20,0" ColumnDefinitions="*,*,300,300">
<Rectangle Grid.Column="0" Fill="Red" WidthRequest="100" HeightRequest="100" HorizontalOptions="Start"/>
<Label Grid.Column="1" Text="Test Titre" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="3" Text="10/85" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
<Grid Margin="20,0,20,0" ColumnDefinitions="*,*,300,300">
<Rectangle Grid.Column="0" Fill="#FFFFFF" WidthRequest="100" HeightRequest="100" HorizontalOptions="Start"/>
<Label Grid.Column="1" Text="Test Titre" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="3" Text="10/85" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
<Grid Margin="20,0,20,0" ColumnDefinitions="*,*,300,300">
<Rectangle Grid.Column="0" Fill="Blue" WidthRequest="100" HeightRequest="100" HorizontalOptions="Start"/>
<Label Grid.Column="1" Text="Test Titre" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="3" Text="10/85" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
<Grid Margin="20,0,20,0" ColumnDefinitions="*,*,300,300">
<Rectangle Grid.Column="0" Fill="Red" WidthRequest="100" HeightRequest="100" HorizontalOptions="Start"/>
<Label Grid.Column="1" Text="Test Titre" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="3" Text="10/85" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
</VerticalStackLayout>
</ScrollView>
</Grid>
</Frame>
</Grid>
</ScrollView>
</ContentPage> </ContentPage>

@ -10,15 +10,15 @@
<Label Text="S'inscrire a MapManga" FontSize="Large" Margin="0,0,0,20" TextColor="#ffffff"/> <Label Text="S'inscrire a MapManga" FontSize="Large" Margin="0,0,0,20" TextColor="#ffffff"/>
<Entry Placeholder="Email" Margin="0,0,0,10" BackgroundColor="#EFF0F2" TextColor="{StaticResource Black}"/> <Entry x:Name="emailEntry" Placeholder="Email" Margin="0,0,0,10" BackgroundColor="#EFF0F2" TextColor="{StaticResource Black}"/>
<Entry Placeholder="Nom d'utilisateur" Margin="0,0,0,10" BackgroundColor="#EFF0F2" TextColor="{StaticResource Black}"/> <Entry x:Name="usernameEntry" Placeholder="Nom d'utilisateur" Margin="0,0,0,10" BackgroundColor="#EFF0F2" TextColor="{StaticResource Black}"/>
<Entry Placeholder="Mot de passe" IsPassword="True" Margin="0,0,0,10" BackgroundColor="#EFF0F2" TextColor="{StaticResource Black}"/> <Entry x:Name="passwordEntry" Placeholder="Mot de passe" IsPassword="True" Margin="0,0,0,10" BackgroundColor="#EFF0F2" TextColor="{StaticResource Black}"/>
<Entry Placeholder="Confirmer le mot de passe" IsPassword="True" Margin="0,0,0,20" BackgroundColor="#EFF0F2" TextColor="{StaticResource Black}"/> <Entry x:Name="confirmPasswordEntry" Placeholder="Confirmer le mot de passe" IsPassword="True" Margin="0,0,0,20" BackgroundColor="#EFF0F2" TextColor="{StaticResource Black}"/>
<Button Text="S'inscire" Clicked="OnLoginClicked" BackgroundColor="{StaticResource Primary}" TextColor="#FFFFFF"/> <Button Text="S'inscire" Clicked="OnSignUpClicked" BackgroundColor="{StaticResource Primary}" TextColor="#FFFFFF"/>
<StackLayout Orientation="Horizontal" HorizontalOptions="Center"> <StackLayout Orientation="Horizontal" HorizontalOptions="Center">
<Label Text="Pas de compte ? " TextColor="#FFFFFF"/> <Label Text="Pas de compte ? " TextColor="#FFFFFF"/>

@ -1,4 +1,5 @@
namespace MangaMap.Views; namespace MangaMap.Views;
using System.Text.RegularExpressions;
public partial class signUpPage : ContentPage public partial class signUpPage : ContentPage
{ {
@ -7,8 +8,38 @@ public partial class signUpPage : ContentPage
InitializeComponent(); InitializeComponent();
} }
private void OnLoginClicked(object sender, EventArgs e) async void OnSignUpClicked(object sender, System.EventArgs e)
{ {
// // Récupérer les valeurs des entrées
string email = emailEntry.Text;
string password = passwordEntry.Text;
string confirmPassword = confirmPasswordEntry.Text;
if (string.IsNullOrWhiteSpace(email) ||
string.IsNullOrWhiteSpace(password) || string.IsNullOrWhiteSpace(confirmPassword))
{
await DisplayAlert("Erreur", "Veuillez remplir tous les champs.", "OK");
return;
}
// Vérifier que l'e-mail a la bonne forme
if (!Regex.IsMatch(email, @"^[^@\s]+@[^@\s]+\.[^@\s]+$"))
{
await DisplayAlert("Erreur", "L'e-mail n'est pas valide.", "OK");
return;
}
// Vérifier si les mots de passe correspondent
if (password != confirmPassword)
{
await DisplayAlert("Erreur", "Les mots de passe ne correspondent pas", "OK");
return;
}
if (password == confirmPassword)
{
await Navigation.PushAsync(new homePage());
}
} }
} }
Loading…
Cancel
Save