Skip to content

Commit

Permalink
fix(feat): not allow user to modify email with EmailConfirmationRequired
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Jul 30, 2023
1 parent a4545bd commit 908c5a1
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/GZCTF/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,7 @@ public async Task<IActionResult> ChangeEmail([FromBody] MailChangeModel model)
var user = await userManager.GetUserAsync(User);

if (!accountPolicy.Value.EmailConfirmationRequired)
{
var result = await userManager.SetEmailAsync(user!, model.NewMail);

if (!result.Succeeded)
return BadRequest(new RequestResponse<bool>(result.Errors.FirstOrDefault()?.Description ?? "邮箱更新失败", false));
return Ok(new RequestResponse<bool>("邮箱已更新", false, 200));
}
return BadRequest(new RequestResponse<bool>("请联系管理员修改邮箱", false));

logger.Log("发送用户邮箱更改邮件", user, TaskStatus.Pending);

Expand Down

0 comments on commit 908c5a1

Please sign in to comment.