Skip to content

Commit

Permalink
[Camden] Refactor generic error template.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Jan 29, 2025
1 parent fea0f9e commit d686d94
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 145 deletions.
23 changes: 15 additions & 8 deletions templates/web/base/errors/generic.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
[% IF message == 'invalid id_token' ~%]
[% title = BLOCK %][% TRY %][% PROCESS 'errors/_sso_title.html' %][% CATCH file %]Login[% END %][% END ~%]
[% END %]
[% DEFAULT title = loc('Error') %]
[% DEFAULT header_class = 'failure' %]
[% INCLUDE 'header.html', title = title %]
[% INCLUDE 'header.html' %]

[% IF csrf_token ~%]
<input type="hidden" name="token" value="[% csrf_token %]">
[% END ~%]

<div class="confirmation-header confirmation-header--[% header_class %]">
<h1>[% title %]</h1>
<p>[% message | safe %]</p>
[% IF error_id %]
<small>[% tprintf(loc('Code: %s'), error_id) %]</small>
[% END %]
</div>
[% IF message == 'invalid id_token' %]
[% PROCESS 'errors/sso.html' %]
[% ELSE %]
<div class="confirmation-header confirmation-header--[% header_class %]">
<h1>[% title %]</h1>
<p>[% message | safe %]</p>
[% IF error_id %]
<small>[% tprintf(loc('Code: %s'), error_id) %]</small>
[% END %]
</div>
[% END %]

[% INCLUDE 'footer.html' %]

21 changes: 21 additions & 0 deletions templates/web/base/errors/sso.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[%
# Very occasionally the user will run into this error when logging in, either because
# the redirects from B2C aren't working correctly, or the user's browser doesn't have
# a cookie set, or their session doesn't have the relevant oauth values stored.
# The exact cause is currently unknown and hard to pin down due to the transient
# nature of the bug.
# Because the login invariably works the next time the user tries, this workaround
# just presents the OIDC login button again (labelled as a 'continue' button...) and
# will thus allow them to login successfully. In theory.
%]
<div>
<h1>[% title %]</h1>
<form action="/auth" method="post" name="general_auth" class="validate">
<input type="hidden" name="r" value="[% c.req.params.r | html %]">
<div class="form-box">
<button name="social_sign_in" value="oidc" class="btn btn--block btn--social btn--oidc">
Click here to continue...
</button>
</div>
</form>
</div>
1 change: 1 addition & 0 deletions templates/web/brent/errors/_sso_title.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
My Account login
46 changes: 0 additions & 46 deletions templates/web/brent/errors/generic.html

This file was deleted.

1 change: 1 addition & 0 deletions templates/web/camden/errors/_sso_title.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Staff login
1 change: 1 addition & 0 deletions templates/web/highwaysengland/errors/_sso_title.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Staff login
45 changes: 0 additions & 45 deletions templates/web/highwaysengland/errors/generic.html

This file was deleted.

1 change: 1 addition & 0 deletions templates/web/tfl/errors/_sso_title.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Staff login
46 changes: 0 additions & 46 deletions templates/web/tfl/errors/generic.html

This file was deleted.

0 comments on commit d686d94

Please sign in to comment.