Skip to content

Commit 411e22f

Browse files
committed
Improving check for passwordHash and also lastModified
1 parent fa9575c commit 411e22f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Integration/Api/ChronicleOutOfProcessFixtureWithLocalImage.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,10 @@ async Task EnsureAdminUserHasPassword()
153153
}
154154
}
155155

156-
// Check if password is already set
157-
if (existingUser.Contains("passwordHash") && !string.IsNullOrEmpty(existingUser["passwordHash"].AsString))
156+
// Check if password is already set (handle BsonNull case)
157+
if (existingUser.Contains("passwordHash") &&
158+
existingUser["passwordHash"] is not BsonNull &&
159+
!string.IsNullOrEmpty(existingUser["passwordHash"].AsString))
158160
{
159161
_logger.LogAdminUserAlreadyHasPassword();
160162
return;
@@ -173,7 +175,7 @@ async Task SetUserPassword(IMongoCollection<BsonDocument> usersCollection, strin
173175
.Set("passwordHash", passwordHash)
174176
.Set("isActive", true)
175177
.Set("requiresPasswordChange", false)
176-
.Set("lastModifiedAt", DateTimeOffset.UtcNow);
178+
.Set("lastModifiedAt", new BsonDateTime(DateTime.UtcNow));
177179

178180
var result = await usersCollection.UpdateOneAsync(
179181
new BsonDocument("username", DefaultAdminUsername),

Source/Workbench/Web/Api/Projections/ProjectionDeclarationSyntaxError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated by Cratis. Source: Cratis.Chronicle.Contracts.Projections.ProjectionDeclarationSyntaxError. Time: 2026-02-01T09:21:23.7150570Z. Hash: 00E5B955632028DD1243CBD33AF6EA260F408D302BED8ED0645FFE59257A2892
1+
// @generated by Cratis. Source: Cratis.Chronicle.Contracts.Projections.ProjectionDeclarationSyntaxError. Time: 2026-02-03T16:53:37.3225470Z. Hash: 00E5B955632028DD1243CBD33AF6EA260F408D302BED8ED0645FFE59257A2892
22
/*---------------------------------------------------------------------------------------------
33
* **DO NOT EDIT** - This file is an automatically generated file.
44
*--------------------------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)