Template
mirror of
https://github.com/egmont11/ASP.Net-Core-MVC-Template.git
synced 2026-07-24 07:09:56 +02:00
Changed Auth to use Identity, with easy to set passsword requirenments via appsettings.json
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace TemplateWeb.Entities;
|
||||
|
||||
public class UserEntity : IdentityUser
|
||||
{
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace TemplateWeb.Models.DbModels;
|
||||
|
||||
public class UserModel
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
[MinLength(3)]
|
||||
public string UserName { get; set; }
|
||||
[Required]
|
||||
[DataType(DataType.EmailAddress)]
|
||||
public string Email { get; set; }
|
||||
[Required]
|
||||
[MinLength(5)]
|
||||
[DataType(DataType.Password)]
|
||||
public string Password { get; set; }
|
||||
|
||||
public UserRole Role { get; set; } = UserRole.User;
|
||||
}
|
||||
|
||||
public enum UserRole
|
||||
{
|
||||
User,
|
||||
Admin
|
||||
}
|
||||
Reference in New Issue
Block a user