Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
sudokoko committed May 31, 2024
1 parent 6941d95 commit f274cf7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ public async Task<IActionResult> ForceVerifyEmail([FromRoute] int id)

UserEntity? targetedUser = await this.database.Users.FirstOrDefaultAsync(u => u.UserId == id);
if (targetedUser == null) return this.NotFound();
if (user.EmailAddressVerified) return this.NotFound();

List<EmailVerificationTokenEntity> tokens = await this.database.EmailVerificationTokens
.Where(t => t.UserId == targetedUser.UserId)
.ToListAsync();
if (tokens.Count == 0) return this.NotFound();
this.database.EmailVerificationTokens.RemoveRange(tokens);

targetedUser.EmailAddressVerified = true;
this.database.EmailVerificationTokens.RemoveRange(tokens);

await this.database.SaveChangesAsync();

Expand Down

0 comments on commit f274cf7

Please sign in to comment.