Disallow forced email verification of users with no email

This commit is contained in:
sudokoko 2024-05-31 18:26:08 -04:00
parent 643cb8e816
commit 3546f60f4f
No known key found for this signature in database
GPG key ID: 248D68C664937395
2 changed files with 3 additions and 3 deletions

View file

@ -103,7 +103,7 @@ public class AdminUserController : ControllerBase
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)

View file

@ -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>
}