diff --git a/src/GZCTF/Controllers/AccountController.cs b/src/GZCTF/Controllers/AccountController.cs index ea4bfdd3e..06ae4189b 100644 --- a/src/GZCTF/Controllers/AccountController.cs +++ b/src/GZCTF/Controllers/AccountController.cs @@ -51,7 +51,7 @@ public async Task Register([FromBody] RegisterModel model, Cancel if (accountPolicy.Value.UseCaptcha && !await captcha.VerifyAsync(model, HttpContext, token)) return BadRequest(new RequestResponse("验证码校验失败")); - if (!VerifyEmailDomain(model.Email.Split('@')[1])) + if (!VerifyEmailDomain(model.Email)) return BadRequest(new RequestResponse($"可用邮箱后缀:{accountPolicy.Value.EmailDomainList}")); var user = new UserInfo { UserName = model.UserName, Email = model.Email, Role = Role.User }; @@ -380,7 +380,7 @@ public async Task ChangeEmail([FromBody] MailChangeModel model) if (await userManager.FindByEmailAsync(model.NewMail) is not null) return BadRequest(new RequestResponse("邮箱已经被占用")); - if (!VerifyEmailDomain(model.NewMail.Split('@')[1])) + if (!VerifyEmailDomain(model.NewMail)) return BadRequest(new RequestResponse($"可用邮箱后缀:{accountPolicy.Value.EmailDomainList}")); UserInfo? user = await userManager.GetUserAsync(User);