mirror of
https://github.com/guilhermewerner/site-pi
synced 2025-06-16 22:04:22 +00:00
Initial commit
This commit is contained in:
37
SitePi/Models/User.cs
Normal file
37
SitePi/Models/User.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SitePi.Models;
|
||||
|
||||
namespace SitePi.Models
|
||||
{
|
||||
public class User
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "This field is required.")]
|
||||
[RegularExpression("^[a-zA-Z0-9-_]*$", ErrorMessage = "That value is not allowed.")]
|
||||
[StringLength(25, MinimumLength = 5, ErrorMessage = "The user name must be at least 5 characters long.")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "This field is required.")]
|
||||
[MaxLength(100)]
|
||||
[RegularExpression(@"^([a-z0-9_\.\+-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$", ErrorMessage = "Please enter a valid email address.")]
|
||||
[DataType(DataType.EmailAddress)]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "This field is required.")]
|
||||
[StringLength(45, MinimumLength = 8, ErrorMessage = "The password must be at least 8 characters long.")]
|
||||
public string PasswordHash { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[Required(ErrorMessage = "This field is required.")]
|
||||
[Compare("PasswordHash", ErrorMessage = "The passwords do not match.")]
|
||||
public string PasswordConfirm { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user