Ajout de connexion et inscription #6

Closed
rayhan.hassou wants to merge 1 commits from rayhan_pageConnexionInscription into master

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
@ -10,7 +10,20 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Content Remove="wwwroot\index.html" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot\images\CraftSharp-Logo.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\fonts\" />
</ItemGroup>
</Project> </Project>

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385 VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CraftSharp", "CraftSharp.csproj", "{C299F384-0C85-4A98-998B-D2704C557CC0}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CraftSharp", "CraftSharp.csproj", "{C299F384-0C85-4A98-998B-D2704C557CC0}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

@ -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; }
}
}

@ -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; }
}
}

@ -0,0 +1,5 @@
<h3>Component</h3>
@code {
}

@ -0,0 +1,37 @@
@page "/connexion"
@layout InscriptionLayout
@inject NavigationManager NavManager
<div class="option">
<h1>Connexion</h1>
<div>
<EditForm Model="@connexion" OnValidSubmit="@seConnecter">
<DataAnnotationsValidator />
<ValidationSummary />
<div class="editForm">
<p>
<label for="display-name">
Pseudonyme:
<InputText id="name" @bind-Value="@connexion.Name" />
</label>
</p>
<p>
<label for="name">
Mot de passe:
<InputText id="password" type="password" @bind-Value="@connexion.Password" />
</label>
</p>
</div>
<div class="choix">
<button classtype="submit"> Se connecter </button>
</div>
</EditForm>
</div>
</div>
<object>
<param name="autostart" value="true">
<param name="src" value="../audio/audio.mp3">
<param name="autoplay" value="true">
<embed src="../audio/audio.mp3" controller="true" autoplay="true" autostart="True" type="audio/mp3" />
</object>

@ -0,0 +1,24 @@
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");
}
}
}
}

@ -0,0 +1,60 @@

.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%;
}

@ -0,0 +1,50 @@
@page "/inscription"
@layout InscriptionLayout
@inject NavigationManager NavManager
<div class="option">
<h1>Inscription</h1>
<div>
<EditForm Model="@inscription" OnValidSubmit="@inscrire">
<DataAnnotationsValidator />
<ValidationSummary />
<div class="editForm">
<p>
<label for="email">
Email:
<InputText id="email" @bind-Value="@inscription.Email" />
</label>
</p>
<p>
<label for="pseudo">
Pseudonyme:
<InputText id="pseudo" @bind-Value="@inscription.Pseudo" />
</label>
</p>
<p>
<label for="password">
Mot de passe:
<InputText id="password" type="password" @bind-Value="@inscription.Password" />
</label>
</p>
<p>
<label for="confimPasswd">
Mot de passe:
<InputText id="confimPasswd" type="password" @bind-Value="@inscription.ConfirmPasswd" />
</label>
</p>
</div>
<div class="choix">
<button classtype="submit"> Valider </button>
</div>
</EditForm>
</div>
</div>
<object>
<param name="autostart" value="true">
<param name="src" value="../audio/audio.mp3">
<param name="autoplay" value="true">
<embed src="../audio/audio.mp3" controller="true" autoplay="true" autostart="True" type="audio/mp3" />
</object>

@ -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()
{
}
}
}

@ -0,0 +1,60 @@

.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%;
}

@ -1,4 +1,5 @@
using CraftSharp.Data; using CraftSharp.Data;
using CraftSharp.Pages;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web;
@ -11,6 +12,7 @@ builder.Services.AddSingleton<WeatherForecastService>();
var app = builder.Build(); var app = builder.Build();
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment()) if (!app.Environment.IsDevelopment())
{ {

@ -0,0 +1,18 @@
@inherits LayoutComponentBase
@inject NavigationManager navigationManager
<div class="connexionBody">
<button @onclick=@getBack id="back">Retour</button>
<header>
<img src="../images/CraftSharp-Logo.png"/>
</header>
@Body
<footer>
<p class="p1">Craft# 1.0</p>
<p class="p2">Copyright KARTAL Emre, VALIN Arthur, HASSOU Rayhan</p>
</footer>
</div>

@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.JSInterop;
using System.Reflection.Metadata;
namespace CraftSharp.Shared
{
public partial class InscriptionLayout
{
void getBack()
{
navigationManager.NavigateTo("Home");
}
}
}

@ -0,0 +1,53 @@
@font-face {
font-family: "Minecraft";
src: url("fonts/Minecraft.ttf") format("truetype");
}
body {
background-image: url("images/fond.jpg");
height: 100%
}
.connexionBody {
background-image: url("images/fond.jpg");
width: 100%;
min-height: 100vh;
}
header img{
width: 50%;
display: block;
margin-left: auto;
margin-right: auto;
}
footer {
position: absolute;
bottom: 0px;
width: 100%;
display:flex;
justify-content: space-between;
}
footer p{
color : white;
font-family: Minecraft;
}
.p2{
float: right;
}
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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 KiB

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
</body>
</html>
Loading…
Cancel
Save