@ -12,7 +12,7 @@ namespace MCTGLib
/// A user is an entity with a name, a surname, mail, profilePict and a list of priority.
/// This user can login with a Id and password
/// </summary>
public class User
public class User : IEquatable < User >
{
#region Private Attributes
@ -21,8 +21,7 @@ namespace MCTGLib
private string mail = "" ;
private string picture = "" ;
private string password = "" ;
//private bool isAdmin;
private string defaultUserSavePath = "" ;
//private string defaultUserSavePath = "";
private List < Priority > priorities ;
# endregion
@ -70,7 +69,7 @@ namespace MCTGLib
public string Mail
{
get { return mail ; }
init
private init
{
if ( string . IsNullOrWhiteSpace ( value ) )
{
@ -79,6 +78,17 @@ namespace MCTGLib
mail = value ;
}
}
///<summary>
/// Property to initiate password, change it, and
/// </summary>
public string Password
{
get { return password ; }
set { password = value ; }
}
/// <summary>
/// For now, we define the ProfilPict as a string which is "PhotoParDefaut"
/// when the value is null.
@ -90,25 +100,6 @@ namespace MCTGLib
}
///<summary>
///Password property
/// </summary>
public string Password
{
get = > password ;
private set
{
string modelPassword = @"[a-z]*[A-Z]+$" ;
if ( ! string . IsNullOrWhiteSpace ( value ) )
{
throw new ArgumentException ( "Le mot de passe ne doit pas etre vide " ) ;
}
// if (Regex.IsMatch(value, modelPassword, RegexOptions. )
}
}
/// <summary>
/// This is the list of priorities specific tu the user. This list is initiate
/// by default. User could change it at will.
@ -120,6 +111,11 @@ namespace MCTGLib
set = > priorities = value ;
}
public bool Equals ( User other )
{
return Name . Equals ( other . Name ) & & Surname . Equals ( other . Surname ) & & Mail . Equals ( other . Mail ) & & ;
}
# endregion
@ -137,7 +133,6 @@ namespace MCTGLib
Name = name ;
Surname = surname ;
Mail = mail ;
Password = password ;
priorities = new List < Priority > {
Priority . Gourmet ,
Priority . Economic ,