commit
b740616b5a
@ -1,58 +1,119 @@
|
||||
<head>
|
||||
<link rel="stylesheet" href="css/composants/formulaires/FormulaireModification.css">
|
||||
</head>
|
||||
|
||||
<EditForm Model="@Modele" OnValidSubmit="@modifierUtilisateur">
|
||||
|
||||
<DataAnnotationsValidator />
|
||||
<Microsoft.AspNetCore.Components.Forms.ValidationSummary />
|
||||
|
||||
<p>
|
||||
<label for="pseudo">
|
||||
Pseudo :
|
||||
<InputText id="pseudo" @bind-Value="Modele.Pseudo" />
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="prenom">
|
||||
Prénom :
|
||||
<InputText id="prenom" @bind-Value="Modele.Prenom" />
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="nom">
|
||||
Nom :
|
||||
<InputText id="nom" @bind-Value="Modele.Nom" />
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="role">
|
||||
Role :
|
||||
<InputText id="role" @bind-Value="Modele.Role" />
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="mail">
|
||||
Email :
|
||||
<InputText id="mail" @bind-Value="Modele.Mail" />
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="mdp">
|
||||
Mot de passe :
|
||||
<InputText id="mdp" @bind-Value="Modele.Mdp" />
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label>
|
||||
Utilisateur banni :
|
||||
<InputCheckbox @bind-Value="Modele.IsBan" />
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<button Type="Submit">Valider la modification </button>
|
||||
|
||||
</EditForm>
|
||||
<div class="formulaire-conteneur">
|
||||
|
||||
<h1 class="title-spacing"> Modifier l'utilisateur</h1>
|
||||
|
||||
<Validations @ref="Validations" Mode="ValidationMode.Manual" Model="Modele">
|
||||
|
||||
<div class="field-container">
|
||||
<Validation>
|
||||
<Field Horizontal>
|
||||
<FieldLabel ColumnSize="ColumnSize.Is2">Pseudo</FieldLabel>
|
||||
<FieldBody ColumnSize="ColumnSize.Is10">
|
||||
<TextEdit Placeholder="Entrez votre pseudo" @bind-Text="@Modele.Pseudo">
|
||||
<Feedback>
|
||||
<ValidationError />
|
||||
</Feedback>
|
||||
</TextEdit>
|
||||
</FieldBody>
|
||||
</Field>
|
||||
</Validation>
|
||||
</div>
|
||||
|
||||
<div class="field-container">
|
||||
<Validation>
|
||||
<Field Horizontal>
|
||||
<FieldLabel ColumnSize="ColumnSize.Is2">Prenom</FieldLabel>
|
||||
<FieldBody ColumnSize="ColumnSize.Is10">
|
||||
<TextEdit Placeholder="Entrez votre prenom" @bind-Text="@Modele.Prenom">
|
||||
<Feedback>
|
||||
<ValidationError />
|
||||
</Feedback>
|
||||
</TextEdit>
|
||||
</FieldBody>
|
||||
</Field>
|
||||
</Validation>
|
||||
</div>
|
||||
|
||||
<div class="field-container">
|
||||
<Validation>
|
||||
<Field Horizontal>
|
||||
<FieldLabel ColumnSize="ColumnSize.Is2">Nom</FieldLabel>
|
||||
<FieldBody ColumnSize="ColumnSize.Is10">
|
||||
<TextEdit Placeholder="Entrez votre nom" @bind-Text="@Modele.Nom">
|
||||
<Feedback>
|
||||
<ValidationError />
|
||||
</Feedback>
|
||||
</TextEdit>
|
||||
</FieldBody>
|
||||
</Field>
|
||||
</Validation>
|
||||
</div>
|
||||
|
||||
<div class="field-container">
|
||||
<Validation>
|
||||
<Field Horizontal>
|
||||
<FieldLabel ColumnSize="ColumnSize.Is2">Mail</FieldLabel>
|
||||
<FieldBody ColumnSize="ColumnSize.Is10">
|
||||
<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.");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +1,12 @@
|
||||
@page "/utilisateurs/modifier/{pseudo}"
|
||||
|
||||
<h1> Modifier l'utilisateur </h1>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="css/pages/utilisateurs/ModifierUtilisateur.css">
|
||||
</head>
|
||||
|
||||
<div class="container">
|
||||
<div class="formulaire-modification">
|
||||
<FormulaireModification Utilisateur="@Utilisateur"/>
|
||||
|
||||
<div class="test">
|
||||
<VeraxShield.composants.authentification.FormulaireInscription>
|
||||
|
||||
</VeraxShield.composants.authentification.FormulaireInscription>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
@ -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 {
|
||||
/* background-color: white; */
|
||||
background-color: #8EC5FC;
|
||||
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh; /* 100% de la hauteur de la vue */
|
||||
}
|
||||
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* Ajoute une ombre légère */
|
||||
.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 */
|
||||
}
|
Loading…
Reference in new issue