Modification des setters de la classe User + regex en commentaire

Popup_qui_marche_pas
Anthony RICHARD 2 years ago
parent 48575315e8
commit 7e36abae2d

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -17,6 +18,7 @@ namespace Model
get { return username; } get { return username; }
private set private set
{ {
if (value == null || value == "") return;
username = value; username = value;
} }
} }
@ -29,8 +31,8 @@ namespace Model
get { return email; } get { return email; }
private set private set
{ {
Regex rg_email = new Regex("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$"); //Regex rg_email = new Regex("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$");
if (rg_email.IsMatch(email)) if (/*rg_email.IsMatch(email)*/value != null)
email = value; email = value;
return; return;
} }
@ -42,12 +44,15 @@ namespace Model
get { return password; } get { return password; }
private set private set
{ {
Regex rg = new Regex("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,32}$"); //Regex rg = new Regex("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,32}$");
if (!rg.IsMatch(password)) return; if (/*!rg.IsMatch(password)*/value == null) return;
password = value; password = value;
} }
} }
private string password; private string password;
public int Role { get; }
private int role;
public List<Game> Followed_Games { get; set; } public List<Game> Followed_Games { get; set; }
public User(string username, string biographie, string email, string password) public User(string username, string biographie, string email, string password)

Loading…
Cancel
Save