File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Auth/LearningHub.Nhs.Auth/Controllers Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,12 @@ await this.interaction.GrantConsentAsync(
145145 }
146146 }
147147
148+ if ( context == null )
149+ {
150+ this . ModelState . AddModelError ( string . Empty , "Invalid request" ) ;
151+ goto showFormWithError ;
152+ }
153+
148154 if ( this . ModelState . IsValid )
149155 {
150156 // validate username/password
@@ -208,6 +214,8 @@ await this.UserService.AddLogonToUserHistory(
208214 this . ModelState . AddModelError ( string . Empty , loginResult . ErrorMessage ) ;
209215 }
210216
217+ showFormWithError :
218+
211219 // something went wrong, show form with error
212220 var vm = await this . BuildLoginViewModelAsync ( model ) ;
213221 if ( ( vm . ClientId == "learninghubwebclient" ) || ( vm . ClientId == "learninghubadmin" ) )
@@ -396,7 +404,7 @@ private async Task<LoginViewModel> BuildLoginViewModelAsync(string returnUrl)
396404 Username = context ? . LoginHint ,
397405 ExternalProviders = providers . ToArray ( ) ,
398406 LoginClientTemplate = loginClientTemplate ?? new LoginClientTemplate ( ) ,
399- ClientId = context . Client . ClientId ,
407+ ClientId = context ? . Client . ClientId ,
400408 } ;
401409 }
402410
You can’t perform that action at this time.
0 commit comments