merge: web admin after the visual, accessibility and RTL review (dark theme, plurals, audit filters)
This commit is contained in:
22 files changed
+1192
-437
No files matched your search
@@ -81,10 +81,11 @@ public static class AdminEndpoints
|
||||
return Results.Json(store.Current(), ProtocolJson.Default.ServerSettingsDto);
|
||||
}
|
||||
|
||||
/// <summary>The audit log, newest first; <c>action</c> may list several actions separated by commas (<c>login,login_failed</c>).</summary>
|
||||
private static async Task<IResult> AuditAsync(HttpContext context, TitanoDatabase db, Guid? user, string? action, string? cursor, int? limit)
|
||||
{
|
||||
var page = await db.Audit.ListAsync(user, string.IsNullOrWhiteSpace(action) ? null : action, limit ?? 100,
|
||||
string.IsNullOrEmpty(cursor) ? null : cursor, context.RequestAborted);
|
||||
var actions = (action ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
var page = await db.Audit.ListByActionsAsync(user, actions, limit ?? 100, string.IsNullOrEmpty(cursor) ? null : cursor, context.RequestAborted);
|
||||
return Results.Json(new Page<AuditEntryDto>([.. page.Items.Select(Dto.Audit)], page.NextCursor, null), ProtocolJson.Default.PageAuditEntryDto);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +119,8 @@ public static class UserEndpoints
|
||||
private static async Task<IResult> ResetPasswordAsync(HttpContext context, Caller caller, Guid id, ResetPasswordRequest? request, TitanoDatabase db, AuditLog audit)
|
||||
{
|
||||
var ct = context.RequestAborted;
|
||||
// A reset ends every session of the account, the caller's too, before the temporary password could be read.
|
||||
if (id == caller.Id) return ApiErrors.Conflict(context, "self");
|
||||
if (await db.Users.GetAsync(id, ct) is not { } user) return ApiErrors.NotFound(context, "user");
|
||||
var password = string.IsNullOrEmpty(request?.Password) ? TemporaryPassword.Generate() : request.Password;
|
||||
if (!PasswordHasher.IsAcceptable(password)) return WeakPassword(context);
|
||||
|
||||
Reference in new issue
Block a user