Skip to content

Commit

Permalink
Disallow forced email verification of users with no email
Browse files Browse the repository at this point in the history
  • Loading branch information
sudokoko committed May 31, 2024
1 parent 643cb8e commit 3546f60
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ 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();
if (user.EmailAddress == null || user.EmailAddressVerified) return this.NotFound();

List<EmailVerificationTokenEntity> tokens = await this.database.EmailVerificationTokens
.Where(t => t.UserId == targetedUser.UserId)
Expand Down
4 changes: 2 additions & 2 deletions ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ else
</a>
}

@if (!Model.ProfileUser.EmailAddressVerified)
@if (Model.ProfileUser.EmailAddress != null && !Model.ProfileUser.EmailAddressVerified)
{
<a class="ui green button" href="/moderation/user/@Model.ProfileUser.UserId/forceVerifyEmail">
<i class="check icon"></i>
<span>Force Verify Email</span>
<span>Forcibly Verify Email</span>
</a>
}

Expand Down

0 comments on commit 3546f60

Please sign in to comment.