From 02a7f7badac59d1bababc7e130516dc0f5aa1e58 Mon Sep 17 00:00:00 2001 From: Jared Snider Date: Thu, 26 Feb 2026 18:40:49 -0500 Subject: [PATCH] PM-32821 - Finish cleaning up old registration endpoint --- src/Api/appsettings.json | 5 -- .../Request/Accounts/RegisterRequestModel.cs | 77 ------------------- 2 files changed, 82 deletions(-) delete mode 100644 src/Identity/Models/Request/Accounts/RegisterRequestModel.cs diff --git a/src/Api/appsettings.json b/src/Api/appsettings.json index 8850c3d26912..e8c465930312 100644 --- a/src/Api/appsettings.json +++ b/src/Api/appsettings.json @@ -120,11 +120,6 @@ "Period": "1m", "Limit": 200 }, - { - "Endpoint": "post:/accounts/register", - "Period": "1m", - "Limit": 2 - }, { "Endpoint": "post:/accounts/password-hint", "Period": "60m", diff --git a/src/Identity/Models/Request/Accounts/RegisterRequestModel.cs b/src/Identity/Models/Request/Accounts/RegisterRequestModel.cs deleted file mode 100644 index 44f44977dd4f..000000000000 --- a/src/Identity/Models/Request/Accounts/RegisterRequestModel.cs +++ /dev/null @@ -1,77 +0,0 @@ -// FIXME: Update this file to be null safe and then delete the line below -#nullable disable - -using System.ComponentModel.DataAnnotations; -using System.Text.Json; -using Bit.Core; -using Bit.Core.Auth.Models.Api.Request.Accounts; -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Utilities; - -namespace Bit.Identity.Models.Request.Accounts; - -public class RegisterRequestModel : IValidatableObject -{ - [StringLength(50)] - public string Name { get; set; } - [Required] - [StrictEmailAddress] - [StringLength(256)] - public string Email { get; set; } - [Required] - [StringLength(1000)] - public string MasterPasswordHash { get; set; } - [StringLength(50)] - public string MasterPasswordHint { get; set; } - public string Key { get; set; } - public KeysRequestModel Keys { get; set; } - public string Token { get; set; } - public Guid? OrganizationUserId { get; set; } - public KdfType? Kdf { get; set; } - public int? KdfIterations { get; set; } - public int? KdfMemory { get; set; } - public int? KdfParallelism { get; set; } - public Dictionary ReferenceData { get; set; } - - public User ToUser() - { - var user = new User - { - Name = Name, - Email = Email, - MasterPasswordHint = MasterPasswordHint, - Kdf = Kdf.GetValueOrDefault(KdfType.PBKDF2_SHA256), - KdfIterations = KdfIterations.GetValueOrDefault(AuthConstants.PBKDF2_ITERATIONS.Default), - KdfMemory = KdfMemory, - KdfParallelism = KdfParallelism - }; - - if (ReferenceData != null) - { - user.ReferenceData = JsonSerializer.Serialize(ReferenceData); - } - - if (Key != null) - { - user.Key = Key; - } - - if (Keys != null) - { - Keys.ToUser(user); - } - - return user; - } - - public IEnumerable Validate(ValidationContext validationContext) - { - if (Kdf.HasValue && KdfIterations.HasValue) - { - return KdfSettingsValidator.Validate(Kdf.Value, KdfIterations.Value, KdfMemory, KdfParallelism); - } - - return Enumerable.Empty(); - } -}