重构项目结构,移除Assignment相关功能,优化Submission模块
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
This commit is contained in:
43
Entities/DTO/User/UserForRegistrationDto.cs
Normal file
43
Entities/DTO/User/UserForRegistrationDto.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using Entities.Contracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.DTO
|
||||
{
|
||||
public class UserForRegistrationDto
|
||||
{
|
||||
[Required(ErrorMessage = "姓名是必填项。")]
|
||||
[StringLength(50, MinimumLength = 2, ErrorMessage = "姓名长度必须在 2 到 50 个字符之间。")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "电子邮件是必填项。")]
|
||||
[EmailAddress(ErrorMessage = "电子邮件格式不正确。")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "密码是必填项。")]
|
||||
[StringLength(100, MinimumLength = 6, ErrorMessage = "密码长度至少为 6 个字符。")]
|
||||
[RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&.])[A-Za-z\d@$!%*?&.]{6,}$",
|
||||
ErrorMessage = "密码必须包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符。特殊字符包含 @$!%*?&. ")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[Compare(nameof(Password), ErrorMessage = "密码和确认密码不匹配。")]
|
||||
[Required(ErrorMessage = "确认密码是必填项。")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "至少选择一个角色。")]
|
||||
public UserRoles Roles { get; set; } = UserRoles.Student;
|
||||
|
||||
[Phone(ErrorMessage = "电话号码格式不正确。")]
|
||||
[StringLength(11, MinimumLength = 11, ErrorMessage = "电话号码必须是 11 位数字。")]
|
||||
public string? PhoneNumber { get; set; }
|
||||
|
||||
[StringLength(200, ErrorMessage = "家庭住址不能超过 200 个字符。")]
|
||||
public string? HomeAddress { get; set; }
|
||||
|
||||
public RegisterUserToClassDto RegisterUserToClassDto { get; set; } = new RegisterUserToClassDto();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user