login changes

This commit is contained in:
roman
2026-06-10 20:39:52 +02:00
parent 841037013a
commit 43011f0a77
13 changed files with 528 additions and 52 deletions
+12 -1
View File
@@ -41,11 +41,22 @@ builder.Services.AddHostedService<ReminderNotificationService>();
var app = builder.Build();
// Auto-migrate pri štarte
// Auto-migrate + seed admin
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
db.Database.Migrate();
if (!db.Users.Any())
{
db.Users.Add(new CalendarReminder.Domain.Entities.User
{
Username = "admin",
Email = "admin@local",
PasswordHash = BCrypt.Net.BCrypt.HashPassword("admin")
});
db.SaveChanges();
}
}
if (app.Environment.IsDevelopment())