mirror of
https://github.com/bitwarden/server
synced 2025-12-21 18:53:41 +00:00
Add support for setting email verified and premium in seed
This commit is contained in:
@@ -25,7 +25,7 @@ public class UserSeeder(RustSdkService sdkService, IPasswordHasher<Bit.Core.Enti
|
||||
return $"{mangleId}+{email}";
|
||||
}
|
||||
|
||||
public User CreateUser(string email)
|
||||
public User CreateUser(string email, bool emailVerified = false, bool premium = false)
|
||||
{
|
||||
email = MangleEmail(email);
|
||||
var keys = sdkService.GenerateUserKeys(email, "asdfasdfasdf");
|
||||
@@ -34,11 +34,13 @@ public class UserSeeder(RustSdkService sdkService, IPasswordHasher<Bit.Core.Enti
|
||||
{
|
||||
Id = CoreHelpers.GenerateComb(),
|
||||
Email = email,
|
||||
EmailVerified = emailVerified,
|
||||
MasterPassword = null,
|
||||
SecurityStamp = "4830e359-e150-4eae-be2a-996c81c5e609",
|
||||
Key = keys.EncryptedUserKey,
|
||||
PublicKey = keys.PublicKey,
|
||||
PrivateKey = keys.PrivateKey,
|
||||
Premium = premium,
|
||||
ApiKey = "7gp59kKHt9kMlks0BuNC4IjNXYkljR",
|
||||
|
||||
Kdf = KdfType.PBKDF2_SHA256,
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace Bit.Seeder.Recipes;
|
||||
|
||||
public class SingleUserRecipe(DatabaseContext db, UserSeeder userSeeder)
|
||||
{
|
||||
public RecipeResult Seed(string email)
|
||||
public RecipeResult Seed(string email, bool emailVerified = false, bool premium = false)
|
||||
{
|
||||
var user = userSeeder.CreateUser(email);
|
||||
var user = userSeeder.CreateUser(email, emailVerified, premium);
|
||||
|
||||
db.Add(user);
|
||||
db.SaveChanges();
|
||||
|
||||
Reference in New Issue
Block a user