-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align Teacher Auth journey with designs (#1267)
- Loading branch information
Showing
34 changed files
with
1,433 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/Pages/CheckAnswers.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@page "/check-answers" | ||
@model TeachingRecordSystem.AuthorizeAccess.Pages.CheckAnswersModel | ||
@{ | ||
ViewBag.Title = "Check your answers"; | ||
} | ||
|
||
@section BeforeContent { | ||
<govuk-back-link href="@LinkGenerator.Trn(Model.JourneyInstance!.InstanceId)" /> | ||
} | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<form action="@LinkGenerator.CheckAnswers(Model.JourneyInstance!.InstanceId)" method="post"> | ||
<h1 class="govuk-heading-l">@ViewBag.Title</h1> | ||
|
||
<p class="govuk-body">Your GOV.UK One Login could not be connected to your teaching record.</p> | ||
|
||
<p class="govuk-body">Check your answers and try again.</p> | ||
|
||
<govuk-summary-list> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key> | ||
National Insurance number | ||
</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value> | ||
@(Model.NationalInsuranceNumber ?? "None") | ||
</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="@LinkGenerator.NationalInsuranceNumber(Model.JourneyInstance!.InstanceId, fromCheckAnswers: true)" visually-hidden-text="National Insurance number">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key> | ||
Teacher reference number | ||
</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value> | ||
@(Model.Trn ?? "None") | ||
</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="@LinkGenerator.Trn(Model.JourneyInstance!.InstanceId, fromCheckAnswers: true)" visually-hidden-text="teacher reference number">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
</govuk-summary-list> | ||
|
||
<govuk-button type="submit">Continue</govuk-button> | ||
</form> | ||
</div> | ||
</div> |
48 changes: 48 additions & 0 deletions
48
TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/Pages/CheckAnswers.cshtml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using TeachingRecordSystem.FormFlow; | ||
|
||
namespace TeachingRecordSystem.AuthorizeAccess.Pages; | ||
|
||
[Journey(SignInJourneyState.JourneyName), RequireJourneyInstance] | ||
public class CheckAnswersModel(SignInJourneyHelper helper) : PageModel | ||
{ | ||
public JourneyInstance<SignInJourneyState>? JourneyInstance { get; set; } | ||
|
||
public string? NationalInsuranceNumber => JourneyInstance!.State.NationalInsuranceNumber; | ||
|
||
public string? Trn => JourneyInstance!.State.Trn; | ||
|
||
public void OnGet() | ||
{ | ||
} | ||
|
||
public IActionResult OnPost() => Redirect(helper.LinkGenerator.NotFound(JourneyInstance!.InstanceId)); | ||
|
||
public override void OnPageHandlerExecuting(PageHandlerExecutingContext context) | ||
{ | ||
var state = JourneyInstance!.State; | ||
|
||
if (state.OneLoginAuthenticationTicket is null || !state.IdentityVerified) | ||
{ | ||
// Not authenticated/verified with One Login | ||
context.Result = BadRequest(); | ||
} | ||
else if (state.AuthenticationTicket is not null) | ||
{ | ||
// Already matched to a Teaching Record | ||
context.Result = Redirect(helper.GetSafeRedirectUri(JourneyInstance)); | ||
} | ||
else if (!state.HaveNationalInsuranceNumber.HasValue) | ||
{ | ||
// Not answered the NINO question | ||
context.Result = Redirect(helper.LinkGenerator.NationalInsuranceNumber(JourneyInstance.InstanceId)); | ||
} | ||
else if (!state.HaveTrn.HasValue) | ||
{ | ||
// Not answered the TRN question | ||
context.Result = Redirect(helper.LinkGenerator.Trn(JourneyInstance.InstanceId)); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/Pages/Connect.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@page "/connect" | ||
@model TeachingRecordSystem.AuthorizeAccess.Pages.ConnectModel | ||
@{ | ||
ViewBag.Title = "Connect your GOV.UK One Login to your teaching record"; | ||
} | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-full"> | ||
<div class="govuk-panel govuk-panel--interruption"> | ||
<form action="@LinkGenerator.Connect(Model.JourneyInstance!.InstanceId)" method="post"> | ||
<h1 class="govuk-panel__title">@ViewBag.Title</h1> | ||
|
||
<div class="govuk-panel__body"> | ||
<p class="govuk-body-l"> | ||
You’ve verified your identity for your GOV.UK One Login. | ||
</p> | ||
|
||
<p class="govuk-body-l"> | ||
You now need to connect it to your teaching record. You’ll be asked for your: | ||
<ul class="govuk-list govuk-list--bullet govuk-body-l"> | ||
<li>National Insurance number</li> | ||
<li>teacher reference number</li> | ||
</ul> | ||
</p> | ||
|
||
<govuk-button class="govuk-!-margin-bottom-0">Connect to your teaching record</govuk-button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
34 changes: 34 additions & 0 deletions
34
TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/Pages/Connect.cshtml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using TeachingRecordSystem.FormFlow; | ||
|
||
namespace TeachingRecordSystem.AuthorizeAccess.Pages; | ||
|
||
[Journey(SignInJourneyState.JourneyName), RequireJourneyInstance] | ||
public class ConnectModel(SignInJourneyHelper helper) : PageModel | ||
{ | ||
public JourneyInstance<SignInJourneyState>? JourneyInstance { get; set; } | ||
|
||
public void OnGet() | ||
{ | ||
} | ||
|
||
public IActionResult OnPost() => Redirect(helper.LinkGenerator.NationalInsuranceNumber(JourneyInstance!.InstanceId)); | ||
|
||
public override void OnPageHandlerExecuting(PageHandlerExecutingContext context) | ||
{ | ||
var state = JourneyInstance!.State; | ||
|
||
if (state.AuthenticationTicket is not null) | ||
{ | ||
// Already matched to a Teaching Record | ||
context.Result = Redirect(helper.GetSafeRedirectUri(JourneyInstance)); | ||
} | ||
else if (state.OneLoginAuthenticationTicket is null || !state.IdentityVerified) | ||
{ | ||
// Not authenticated/verified with One Login | ||
context.Result = BadRequest(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/Pages/Found.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@page "/found" | ||
@model TeachingRecordSystem.AuthorizeAccess.Pages.FoundModel | ||
@{ | ||
ViewBag.Title = "We’ve found your teaching record"; | ||
} | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-full"> | ||
<form action="@LinkGenerator.Found(Model.JourneyInstance!.InstanceId)" method="post"> | ||
<govuk-panel class="trs-panel--left"> | ||
<govuk-panel-title> | ||
Your GOV.UK One Login is connected to your teaching record | ||
</govuk-panel-title> | ||
<govuk-panel-body> | ||
<p class="govuk-body-l"> | ||
You won’t need to do this again. | ||
</p> | ||
|
||
<govuk-button type="submit" class="govuk-!-margin-bottom-0">Access your teaching record</govuk-button> | ||
</govuk-panel-body> | ||
</govuk-panel> | ||
</form> | ||
</div> | ||
</div> |
29 changes: 29 additions & 0 deletions
29
TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/Pages/Found.cshtml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using TeachingRecordSystem.FormFlow; | ||
|
||
namespace TeachingRecordSystem.AuthorizeAccess.Pages; | ||
|
||
[Journey(SignInJourneyState.JourneyName), RequireJourneyInstance] | ||
public class FoundModel(SignInJourneyHelper helper) : PageModel | ||
{ | ||
public JourneyInstance<SignInJourneyState>? JourneyInstance { get; set; } | ||
|
||
public void OnGet() | ||
{ | ||
} | ||
|
||
public IActionResult OnPost() => Redirect(helper.GetNextPage(JourneyInstance!)); | ||
|
||
public override void OnPageHandlerExecuting(PageHandlerExecutingContext context) | ||
{ | ||
var state = JourneyInstance!.State; | ||
|
||
if (state.AuthenticationTicket is null) | ||
{ | ||
// Not matched | ||
context.Result = Redirect(helper.GetNextPage(JourneyInstance)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.