File tree 2 files changed +10
-13
lines changed
2 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ public override async Task OnConnectedAsync()
12
12
HttpContext ? context = Context . GetHttpContext ( ) ;
13
13
14
14
if ( context is null
15
- || ! await HubHelper . HasUser ( context )
16
15
|| ! context . Request . Query . TryGetValue ( "game" , out StringValues gameId )
17
16
|| ! int . TryParse ( gameId , out var gId ) )
18
17
{
Original file line number Diff line number Diff line change 98
98
#region Configuration
99
99
100
100
if ( ! GZCTF . Program . IsTesting )
101
+ {
101
102
try
102
103
{
103
104
builder . Configuration . AddEntityConfiguration ( options =>
116
117
builder . Configuration . GetConnectionString ( "Database" ) ?? "null" ] ) ;
117
118
GZCTF . Program . ExitWithFatalMessage (
118
119
GZCTF . Program . StaticLocalizer [ nameof ( GZCTF . Resources . Program . Database_ConnectionFailed ) , e . Message ] ) ;
119
- }
120
+ }
121
+ }
120
122
121
123
#endregion Configuration
122
124
@@ -406,21 +408,17 @@ public static void ExitWithFatalMessage(string msg)
406
408
407
409
public static IActionResult InvalidModelStateHandler ( ActionContext context )
408
410
{
409
- string ? errors = null ;
410
411
var localizer = context . HttpContext . RequestServices . GetRequiredService < IStringLocalizer < Program > > ( ) ;
411
412
if ( context . ModelState . ErrorCount <= 0 )
412
- return new JsonResult (
413
- new RequestResponse ( errors is [ _, ..]
414
- ? errors
415
- : localizer [ nameof ( Resources . Program . Model_ValidationFailed ) ] ) )
413
+ return new JsonResult ( new RequestResponse (
414
+ localizer [ nameof ( Resources . Program . Model_ValidationFailed ) ] ) )
416
415
{ StatusCode = 400 } ;
417
416
418
- errors = ( from val in context . ModelState . Values
419
- where val . Errors . Count > 0
420
- select val . Errors . FirstOrDefault ( ) ? . ErrorMessage ) . FirstOrDefault ( ) ;
421
-
422
- return new JsonResult ( new RequestResponse ( errors is [ _, ..]
423
- ? errors
417
+ var error = context . ModelState . Values . Where ( v => v . Errors . Count > 0 )
418
+ . Select ( v => v . Errors . FirstOrDefault ( ) ? . ErrorMessage ) . FirstOrDefault ( ) ;
419
+
420
+ return new JsonResult ( new RequestResponse ( error is [ _, ..]
421
+ ? error
424
422
: localizer [ nameof ( Resources . Program . Model_ValidationFailed ) ] ) )
425
423
{ StatusCode = 400 } ;
426
424
}
You can’t perform that action at this time.
0 commit comments