1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-05 18:12:48 -05:00

Resolves Auth Warnings (#4642)

* Resolve Auth Warnings

* Move Assertion

* ClaimsPrincipal is actually nullable
This commit is contained in:
Justin Baur
2024-08-16 09:32:25 -04:00
committed by GitHub
parent 07ef299f1e
commit abb223aabb
5 changed files with 15 additions and 10 deletions

View File

@ -7,9 +7,8 @@ namespace Bit.Core.Auth.Models.Api.Request.Accounts;
public class RegisterSendVerificationEmailRequestModel
{
[StringLength(50)] public string? Name { get; set; }
[Required]
[StrictEmailAddress]
[StringLength(256)]
public string Email { get; set; }
public required string Email { get; set; }
public bool ReceiveMarketingEmails { get; set; }
}

View File

@ -6,12 +6,10 @@ namespace Bit.Core.Auth.Models.Api.Request.Accounts;
public class RegisterVerificationEmailClickedRequestModel
{
[Required]
[StrictEmailAddress]
[StringLength(256)]
public string Email { get; set; }
public required string Email { get; set; }
[Required]
public string EmailVerificationToken { get; set; }
public required string EmailVerificationToken { get; set; }
}

View File

@ -122,6 +122,7 @@ public class AuthRequestService : IAuthRequestService
throw new BadRequestException("User does not belong to any organizations.");
}
Debug.Assert(user is not null, "user should have been validated to be non-null and thrown if it's not.");
// A user event will automatically create logs for each organization/provider this user belongs to.
await _eventService.LogUserEventAsync(user.Id, EventType.User_RequestedDeviceApproval);
@ -136,6 +137,7 @@ public class AuthRequestService : IAuthRequestService
return firstAuthRequest!;
}
Debug.Assert(user is not null, "user should have been validated to be non-null and thrown if it's not.");
var authRequest = await CreateAuthRequestAsync(model, user, organizationId: null);
await _pushNotificationService.PushAuthRequestAsync(authRequest);
return authRequest;