commit
b740616b5a
@ -1,58 +1,119 @@
|
|||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="css/composants/formulaires/FormulaireModification.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
<EditForm Model="@Modele" OnValidSubmit="@modifierUtilisateur">
|
<div class="formulaire-conteneur">
|
||||||
|
|
||||||
<DataAnnotationsValidator />
|
<h1 class="title-spacing"> Modifier l'utilisateur</h1>
|
||||||
<Microsoft.AspNetCore.Components.Forms.ValidationSummary />
|
|
||||||
|
<Validations @ref="Validations" Mode="ValidationMode.Manual" Model="Modele">
|
||||||
<p>
|
|
||||||
<label for="pseudo">
|
<div class="field-container">
|
||||||
Pseudo :
|
<Validation>
|
||||||
<InputText id="pseudo" @bind-Value="Modele.Pseudo" />
|
<Field Horizontal>
|
||||||
</label>
|
<FieldLabel ColumnSize="ColumnSize.Is2">Pseudo</FieldLabel>
|
||||||
</p>
|
<FieldBody ColumnSize="ColumnSize.Is10">
|
||||||
|
<TextEdit Placeholder="Entrez votre pseudo" @bind-Text="@Modele.Pseudo">
|
||||||
<p>
|
<Feedback>
|
||||||
<label for="prenom">
|
<ValidationError />
|
||||||
Prénom :
|
</Feedback>
|
||||||
<InputText id="prenom" @bind-Value="Modele.Prenom" />
|
</TextEdit>
|
||||||
</label>
|
</FieldBody>
|
||||||
</p>
|
</Field>
|
||||||
|
</Validation>
|
||||||
<p>
|
</div>
|
||||||
<label for="nom">
|
|
||||||
Nom :
|
<div class="field-container">
|
||||||
<InputText id="nom" @bind-Value="Modele.Nom" />
|
<Validation>
|
||||||
</label>
|
<Field Horizontal>
|
||||||
</p>
|
<FieldLabel ColumnSize="ColumnSize.Is2">Prenom</FieldLabel>
|
||||||
|
<FieldBody ColumnSize="ColumnSize.Is10">
|
||||||
<p>
|
<TextEdit Placeholder="Entrez votre prenom" @bind-Text="@Modele.Prenom">
|
||||||
<label for="role">
|
<Feedback>
|
||||||
Role :
|
<ValidationError />
|
||||||
<InputText id="role" @bind-Value="Modele.Role" />
|
</Feedback>
|
||||||
</label>
|
</TextEdit>
|
||||||
</p>
|
</FieldBody>
|
||||||
|
</Field>
|
||||||
<p>
|
</Validation>
|
||||||
<label for="mail">
|
</div>
|
||||||
Email :
|
|
||||||
<InputText id="mail" @bind-Value="Modele.Mail" />
|
<div class="field-container">
|
||||||
</label>
|
<Validation>
|
||||||
</p>
|
<Field Horizontal>
|
||||||
|
<FieldLabel ColumnSize="ColumnSize.Is2">Nom</FieldLabel>
|
||||||
<p>
|
<FieldBody ColumnSize="ColumnSize.Is10">
|
||||||
<label for="mdp">
|
<TextEdit Placeholder="Entrez votre nom" @bind-Text="@Modele.Nom">
|
||||||
Mot de passe :
|
<Feedback>
|
||||||
<InputText id="mdp" @bind-Value="Modele.Mdp" />
|
<ValidationError />
|
||||||
</label>
|
</Feedback>
|
||||||
</p>
|
</TextEdit>
|
||||||
|
</FieldBody>
|
||||||
<p>
|
</Field>
|
||||||
<label>
|
</Validation>
|
||||||
Utilisateur banni :
|
</div>
|
||||||
<InputCheckbox @bind-Value="Modele.IsBan" />
|
|
||||||
</label>
|
<div class="field-container">
|
||||||
</p>
|
<Validation>
|
||||||
|
<Field Horizontal>
|
||||||
<button Type="Submit">Valider la modification </button>
|
<FieldLabel ColumnSize="ColumnSize.Is2">Mail</FieldLabel>
|
||||||
|
<FieldBody ColumnSize="ColumnSize.Is10">
|
||||||
</EditForm>
|
<TextEdit Placeholder="Entrez votre mail" @bind-Text="@Modele.Mail">
|
||||||
|
<Feedback>
|
||||||
|
<ValidationError />
|
||||||
|
</Feedback>
|
||||||
|
</TextEdit>
|
||||||
|
</FieldBody>
|
||||||
|
</Field>
|
||||||
|
</Validation>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field-container">
|
||||||
|
<Validation>
|
||||||
|
<Field Horizontal>
|
||||||
|
<FieldLabel ColumnSize="ColumnSize.Is2">Role</FieldLabel>
|
||||||
|
<FieldBody ColumnSize="ColumnSize.Is10">
|
||||||
|
<TextEdit Placeholder="Entrez le role" @bind-Text="@Modele.Role">
|
||||||
|
<Feedback>
|
||||||
|
<ValidationError />
|
||||||
|
</Feedback>
|
||||||
|
</TextEdit>
|
||||||
|
</FieldBody>
|
||||||
|
</Field>
|
||||||
|
</Validation>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field-container">
|
||||||
|
<Validation>
|
||||||
|
<Field Horizontal>
|
||||||
|
<FieldLabel ColumnSize="ColumnSize.Is2">Mot de passe</FieldLabel>
|
||||||
|
<FieldBody ColumnSize="ColumnSize.Is10">
|
||||||
|
<TextEdit Placeholder="Entrez votre mot de passe" @bind-Text="@Modele.Mdp">
|
||||||
|
<Feedback>
|
||||||
|
<ValidationError />
|
||||||
|
</Feedback>
|
||||||
|
</TextEdit>
|
||||||
|
</FieldBody>
|
||||||
|
</Field>
|
||||||
|
</Validation>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<Validation>
|
||||||
|
<Switch TValue="bool" @bind-Checked="@Modele.IsBan" Color="Color.Primary">Utilisateur banni</Switch>
|
||||||
|
</Validation>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="btn-container">
|
||||||
|
<Button Class="btn-se-connecter" Clicked="@modifierUtilisateur">
|
||||||
|
<Icon Name="Blazorise.Icons.FontAwesome.FontAwesomeIcons.CheckCircle" />
|
||||||
|
Modifier</Button>
|
||||||
|
<Button Class="btn-s-inscrire" Clicked="@OnAnnulation">
|
||||||
|
<Icon Name="Blazorise.Icons.FontAwesome.FontAwesomeIcons.Reply" />
|
||||||
|
Annuler</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</Validations>
|
||||||
|
</div>
|
@ -0,0 +1,28 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using VeraxShield.composants.affichages.utilisateurs;
|
||||||
|
using VeraxShield.modele.utilisateurs;
|
||||||
|
using VeraxShield.services.UtilisateursDataService;
|
||||||
|
|
||||||
|
namespace VeraxShield.composants.formulaires.modeles.attributsValidationCustoms
|
||||||
|
{
|
||||||
|
public class PseudoCorrectAttribute : ValidationAttribute
|
||||||
|
{
|
||||||
|
|
||||||
|
protected override ValidationResult? IsValid(object? value, ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
bool pseudoExisteDeja = false;
|
||||||
|
var pseudo = (string)value;
|
||||||
|
|
||||||
|
foreach (Utilisateur u in DatagridUtilisateurs.Utilisateurs)
|
||||||
|
{
|
||||||
|
if (u.Pseudo == pseudo && pseudo != DatagridUtilisateurs.UtilisateurSelectionne.Pseudo)
|
||||||
|
{
|
||||||
|
return new ValidationResult("Le pseudo existe deja, choississez en un autre.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ValidationResult.Success;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace VeraxShield.composants.formulaires.modeles.attributsValidationCustoms
|
||||||
|
{
|
||||||
|
public class RoleExistantAttribute : ValidationAttribute
|
||||||
|
{
|
||||||
|
private List<string> RolesExistants {get; set;}
|
||||||
|
|
||||||
|
public RoleExistantAttribute()
|
||||||
|
{
|
||||||
|
this.RolesExistants = new List<string>();
|
||||||
|
this.RolesExistants.Add("admin");
|
||||||
|
this.RolesExistants.Add("modo");
|
||||||
|
this.RolesExistants.Add("invite");
|
||||||
|
this.RolesExistants.Add("redacteur");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override ValidationResult? IsValid(object? value, ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
var role = (string)value;
|
||||||
|
|
||||||
|
foreach (string roleListe in this.RolesExistants)
|
||||||
|
{
|
||||||
|
if (roleListe == role)
|
||||||
|
{
|
||||||
|
return ValidationResult.Success;;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ValidationResult("Le role n'existe pas.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
.formulaire-conteneur {
|
||||||
|
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Ajoute une ombre au formulaire */
|
||||||
|
border-radius: 10px; /* Ajoute des bords arrondis au formulaire */
|
||||||
|
|
||||||
|
/* background-color: black; */
|
||||||
|
background-color: #8BC6EC;
|
||||||
|
background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);
|
||||||
|
|
||||||
|
color: white; /* Définit la couleur du texte à blanc */
|
||||||
|
padding: 20px; /* Ajoute une marge intérieure pour plus de lisibilité */
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-spacing {
|
||||||
|
margin-bottom: 20px; /* Ajoute une séparation entre le titre et le reste du contenu */
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-container {
|
||||||
|
margin-bottom: 15px; /* Ajoute une séparation entre chaque champ */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Rend les labels en gras et blancs */
|
||||||
|
.field-label {
|
||||||
|
font-weight: bold;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 20px; /* Ajoute une séparation entre les champs et les boutons */
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-se-connecter {
|
||||||
|
/* background-color: darkblue; */
|
||||||
|
|
||||||
|
/*background: #F3904F; fallback for old browsers */
|
||||||
|
/*background: -webkit-linear-gradient(to right, #3B4371, #F3904F); Chrome 10-25, Safari 5.1-6 */
|
||||||
|
/*background: linear-gradient(to right, #3B4371, #F3904F); W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
||||||
|
|
||||||
|
background: white;
|
||||||
|
color: black;
|
||||||
|
margin-right: 10px; /* Ajoute un espace entre les deux boutons */
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-s-inscrire {
|
||||||
|
background-color: white;
|
||||||
|
/* color: white; */
|
||||||
|
color: black;
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
/* Ajoutez ces styles à votre fichier CSS associé au composant (FormulaireModification.css) */
|
||||||
|
|
||||||
|
.formulaire-conteneur {
|
||||||
|
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Ajoute une ombre au formulaire */
|
||||||
|
border-radius: 10px; /* Ajoute des bords arrondis au formulaire */
|
||||||
|
|
||||||
|
/* background-color: black; */
|
||||||
|
background-color: #8BC6EC;
|
||||||
|
background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);
|
||||||
|
|
||||||
|
color: white; /* Définit la couleur du texte à blanc */
|
||||||
|
padding: 20px; /* Ajoute une marge intérieure pour plus de lisibilité */
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-spacing {
|
||||||
|
margin-bottom: 20px; /* Ajoute une séparation entre le titre et le reste du contenu */
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-container {
|
||||||
|
margin-bottom: 15px; /* Ajoute une séparation entre chaque champ */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Rend les labels en gras et blancs */
|
||||||
|
.field-label {
|
||||||
|
font-weight: bold;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 20px; /* Ajoute une séparation entre les champs et les boutons */
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-se-connecter {
|
||||||
|
/* background-color: darkblue; */
|
||||||
|
|
||||||
|
/*background: #F3904F; fallback for old browsers */
|
||||||
|
/*background: -webkit-linear-gradient(to right, #3B4371, #F3904F); Chrome 10-25, Safari 5.1-6 */
|
||||||
|
/*background: linear-gradient(to right, #3B4371, #F3904F); W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
||||||
|
|
||||||
|
background: white;
|
||||||
|
color: black;
|
||||||
|
margin-right: 10px; /* Ajoute un espace entre les deux boutons */
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-s-inscrire {
|
||||||
|
background-color: white;
|
||||||
|
/* color: white; */
|
||||||
|
color: black;
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh; /* 100% de la hauteur de la vue */
|
||||||
|
}
|
||||||
|
|
||||||
|
.formulaire-modification {
|
||||||
|
width: 50%;
|
||||||
|
/* background-color: green;
|
||||||
|
padding: 20px; */
|
||||||
|
/*box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); Ajoute une ombre au formulaire */
|
||||||
|
/* border-radius: 10px; Ajoute des bords arrondis au formulaire */
|
||||||
|
}
|
@ -1,9 +1,14 @@
|
|||||||
.test {
|
.container {
|
||||||
/* background-color: white; */
|
display: flex;
|
||||||
background-color: #8EC5FC;
|
justify-content: center;
|
||||||
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
|
align-items: center;
|
||||||
|
height: 100vh; /* 100% de la hauteur de la vue */
|
||||||
|
}
|
||||||
|
|
||||||
padding: 20px;
|
.formulaire-modification {
|
||||||
border-radius: 10px;
|
width: 50%;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Ajoute une ombre légère */
|
/* background-color: green;
|
||||||
|
padding: 20px; */
|
||||||
|
/*box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); Ajoute une ombre au formulaire */
|
||||||
|
/* border-radius: 10px; Ajoute des bords arrondis au formulaire */
|
||||||
}
|
}
|
Loading…
Reference in new issue