diff --git a/src/CraftSharp/Models/ConnexionModel.cs b/src/CraftSharp/Models/ConnexionModel.cs new file mode 100644 index 0000000..0979c90 --- /dev/null +++ b/src/CraftSharp/Models/ConnexionModel.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; + +namespace CraftSharp.Models +{ + public class ConnexionModel + { + [Required(ErrorMessage = "Le pseudo est obligatoire.")] + [StringLength(50, ErrorMessage = "Le pseudo est trop long")] + public string? Name { get; set; } + + [Required(ErrorMessage = "Le mot de passe est obligatoire.")] + [StringLength(50, ErrorMessage = "Le mot de passe est trop long")] + public string? Password { get; set; } + } +} diff --git a/src/CraftSharp/Models/InscriptionModel.cs b/src/CraftSharp/Models/InscriptionModel.cs new file mode 100644 index 0000000..30c618d --- /dev/null +++ b/src/CraftSharp/Models/InscriptionModel.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations; + +namespace CraftSharp.Models +{ + public class InscriptionModel + { + + [Required(ErrorMessage = "Le pseudo est obligatoire.")] + [StringLength(50, ErrorMessage = "Le pseudo est trop long")] + public string? Pseudo { get; set; } + + [Required(ErrorMessage = "L'email est obligatoire.")] + [StringLength(50, ErrorMessage = "Le nom ne doit pas dépasser 50 caractères.")] + [RegularExpression(@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$", ErrorMessage = "Le format de l'email n'est pas correcte.")] + public string? Email { get; set; } + + [Required(ErrorMessage = "Le mot de passe est obligatoire.")] + [StringLength(50, ErrorMessage = "Le mot de passe est trop long")] + public string? Password { get; set; } + + [Required(ErrorMessage = "Vous devez confirmer votre mot de passe")] + [StringLength(50, ErrorMessage = "Le pseudo est trop long")] + public string? ConfirmPasswd { get; set; } + } +} \ No newline at end of file diff --git a/src/CraftSharp/Pages/Connexion.razor b/src/CraftSharp/Pages/Connexion.razor new file mode 100644 index 0000000..0c41710 --- /dev/null +++ b/src/CraftSharp/Pages/Connexion.razor @@ -0,0 +1,37 @@ +@page "/connexion" +@layout InscriptionLayout +@inject NavigationManager NavManager + +
+

Connexion

+
+ + + + +
+

+ +

+

+ +

+
+
+ +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/src/CraftSharp/Pages/Connexion.razor.cs b/src/CraftSharp/Pages/Connexion.razor.cs new file mode 100644 index 0000000..266d819 --- /dev/null +++ b/src/CraftSharp/Pages/Connexion.razor.cs @@ -0,0 +1,25 @@ +using Microsoft.Extensions.Logging; +using System; +using System.ComponentModel.DataAnnotations; +using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Components; +using CraftSharp.Models; + +namespace CraftSharp.Pages +{ + public partial class Connexion + { + private readonly ConnexionModel connexion = new(); + + private string _connexionId = "test"; + private string _connexionPasswrd = "test"; + + private void seConnecter() + { + if (connexion.Name == _connexionId && connexion.Password == _connexionPasswrd) + { + NavManager.NavigateTo("/counter"); + } + } + } +} diff --git a/src/CraftSharp/Pages/Connexion.razor.css b/src/CraftSharp/Pages/Connexion.razor.css new file mode 100644 index 0000000..715f868 --- /dev/null +++ b/src/CraftSharp/Pages/Connexion.razor.css @@ -0,0 +1,58 @@ +.option { + margin-left: auto; + margin-right: auto; + width: 500px +} + +button:hover { + background: url('Images/btn2.png') no-repeat; +} + +h1 { + color: white; + font-family: Minecraft; + margin-left: 25%; + margin-right: 25%; +} + +.choix { + display: flex; + justify-content: space-around; +} + +object { + visibility: hidden; +} + +button { + width: 12rem; + text-decoration: none; + text-align: center; + color: white; + cursor: pointer; + background: url('Images/btn1.png') no-repeat; + font-family: SilkscreenNormal; + line-height: 26px; + padding-top: 6px; + font-family: Minecraft; +} + +InputText { + width: 100%; +} + +.ecrire { + margin-left: auto; + margin-right: auto; + width: 6em +} + +label { + width: 15rem; +} + +.editForm { + margin-left: 25%; + margin-right: 25%; + width: 100%; +} diff --git a/src/CraftSharp/Pages/Inscription.razor b/src/CraftSharp/Pages/Inscription.razor new file mode 100644 index 0000000..1d93e71 --- /dev/null +++ b/src/CraftSharp/Pages/Inscription.razor @@ -0,0 +1,50 @@ +@page "/inscription" +@layout InscriptionLayout +@inject NavigationManager NavManager + +
+

Inscription

+
+ + + + +
+

+ +

+

+ +

+

+ +

+

+ +

+
+
+ +
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/src/CraftSharp/Pages/Inscription.razor.cs b/src/CraftSharp/Pages/Inscription.razor.cs new file mode 100644 index 0000000..1530f25 --- /dev/null +++ b/src/CraftSharp/Pages/Inscription.razor.cs @@ -0,0 +1,18 @@ +using Microsoft.Extensions.Logging; +using System; +using System.ComponentModel.DataAnnotations; +using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Components; +using CraftSharp.Models; + +namespace CraftSharp.Pages +{ + public partial class Inscription + { + private readonly InscriptionModel inscription = new(); + + private void inscrire() + { + } + } +} diff --git a/src/CraftSharp/Pages/Inscription.razor.css b/src/CraftSharp/Pages/Inscription.razor.css new file mode 100644 index 0000000..715f868 --- /dev/null +++ b/src/CraftSharp/Pages/Inscription.razor.css @@ -0,0 +1,58 @@ +.option { + margin-left: auto; + margin-right: auto; + width: 500px +} + +button:hover { + background: url('Images/btn2.png') no-repeat; +} + +h1 { + color: white; + font-family: Minecraft; + margin-left: 25%; + margin-right: 25%; +} + +.choix { + display: flex; + justify-content: space-around; +} + +object { + visibility: hidden; +} + +button { + width: 12rem; + text-decoration: none; + text-align: center; + color: white; + cursor: pointer; + background: url('Images/btn1.png') no-repeat; + font-family: SilkscreenNormal; + line-height: 26px; + padding-top: 6px; + font-family: Minecraft; +} + +InputText { + width: 100%; +} + +.ecrire { + margin-left: auto; + margin-right: auto; + width: 6em +} + +label { + width: 15rem; +} + +.editForm { + margin-left: 25%; + margin-right: 25%; + width: 100%; +} diff --git a/src/CraftSharp/Shared/HeaderLayout.razor b/src/CraftSharp/Shared/HeaderLayout.razor index 5c9ba21..87dc25b 100644 --- a/src/CraftSharp/Shared/HeaderLayout.razor +++ b/src/CraftSharp/Shared/HeaderLayout.razor @@ -1,4 +1,5 @@ -