-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error handling in login view (#55)
* Add 403 error handler * Raise 403 if user is not authenticated * Display helper text and highlight input fields on 403 in login form * Remove 403 related styling and text on login errors other than 403 * Fix failing test * Remove redundant user check and exception * Raise NotAuthenticated when Zino authentication fails --------- Co-authored-by: Hanne Moa <[email protected]>
- Loading branch information
1 parent
166458f
commit cfbe2be
Showing
10 changed files
with
188 additions
and
111 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,123 @@ | ||
/***** BULK UPDATE REQUEST INDICATOR ****/ | ||
.bulk-update-htmx-indicator { | ||
display: none; | ||
} | ||
|
||
.bulk-update-htmx-indicator { | ||
display: none; | ||
} | ||
|
||
.htmx-request .bulk-update-htmx-indicator { | ||
display: inline; | ||
} | ||
.htmx-request .bulk-update-htmx-indicator { | ||
display: inline; | ||
} | ||
|
||
.htmx-request.bulk-update-htmx-indicator { | ||
display: inline; | ||
} | ||
.htmx-request.bulk-update-htmx-indicator { | ||
display: inline; | ||
} | ||
|
||
/***** MODAL DIALOG ****/ | ||
/***** MODAL DIALOG ****/ | ||
#modal { | ||
/* Underlay covers entire screen. */ | ||
position: fixed; | ||
top:0px; | ||
bottom: 0px; | ||
left:0px; | ||
right:0px; | ||
background-color:rgba(0,0,0,0.5); | ||
z-index:1000; | ||
|
||
/* Flexbox centers the .modal-content vertically and horizontally */ | ||
display:flex; | ||
flex-direction:column; | ||
align-items:center; | ||
|
||
/* Animate when opening */ | ||
animation-name: fadeIn; | ||
animation-duration:150ms; | ||
animation-timing-function: ease; | ||
/* Underlay covers entire screen. */ | ||
position: fixed; | ||
top: 0px; | ||
bottom: 0px; | ||
left: 0px; | ||
right: 0px; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
z-index: 1000; | ||
|
||
/* Flexbox centers the .modal-content vertically and horizontally */ | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
|
||
/* Animate when opening */ | ||
animation-name: fadeIn; | ||
animation-duration: 150ms; | ||
animation-timing-function: ease; | ||
} | ||
|
||
/*#modal > .modal-underlay*/ | ||
/*#event-details-modal > .modal-underlay*/ | ||
#update-event-status-modal > .modal-underlay, .modal-underlay { | ||
/* underlay takes up the entire viewport. This is only | ||
required if you want to click to dismiss the popup */ | ||
position: absolute; | ||
z-index: -1; | ||
top:0px; | ||
bottom:0px; | ||
left: 0px; | ||
right: 0px; | ||
/* underlay takes up the entire viewport. This is only | ||
required if you want to click to dismiss the popup */ | ||
position: absolute; | ||
z-index: -1; | ||
top: 0px; | ||
bottom: 0px; | ||
left: 0px; | ||
right: 0px; | ||
} | ||
|
||
#update-event-status-modal > .modal-content { | ||
/* Position visible dialog near the top of the window */ | ||
margin-top:10vh; | ||
|
||
/* Sizing for visible dialog */ | ||
width:80%; | ||
max-width:600px; | ||
|
||
/* Display properties for visible dialog*/ | ||
border:solid 1px #999; | ||
border-radius:8px; | ||
box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.3); | ||
background-color:white; | ||
padding:20px; | ||
|
||
/* Animate when opening */ | ||
animation-name:zoomIn; | ||
animation-duration:150ms; | ||
animation-timing-function: ease; | ||
/* Position visible dialog near the top of the window */ | ||
margin-top: 10vh; | ||
|
||
/* Sizing for visible dialog */ | ||
width: 80%; | ||
max-width: 600px; | ||
|
||
/* Display properties for visible dialog*/ | ||
border: solid 1px #999; | ||
border-radius: 8px; | ||
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.3); | ||
background-color: white; | ||
padding: 20px; | ||
|
||
/* Animate when opening */ | ||
animation-name: zoomIn; | ||
animation-duration: 150ms; | ||
animation-timing-function: ease; | ||
} | ||
|
||
#modal.closing { | ||
/* Animate when closing */ | ||
animation-name: fadeOut; | ||
animation-duration:150ms; | ||
animation-timing-function: ease; | ||
/* Animate when closing */ | ||
animation-name: fadeOut; | ||
animation-duration: 150ms; | ||
animation-timing-function: ease; | ||
} | ||
|
||
#modal.closing > .modal-content { | ||
/* Animate when closing */ | ||
animation-name: zoomOut; | ||
animation-duration:150ms; | ||
animation-timing-function: ease; | ||
/* Animate when closing */ | ||
animation-name: zoomOut; | ||
animation-duration: 150ms; | ||
animation-timing-function: ease; | ||
} | ||
|
||
@keyframes fadeIn { | ||
0% {opacity: 0;} | ||
100% {opacity: 1;} | ||
0% { | ||
opacity: 0; | ||
} | ||
100% { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
@keyframes fadeOut { | ||
0% {opacity: 1;} | ||
100% {opacity: 0;} | ||
0% { | ||
opacity: 1; | ||
} | ||
100% { | ||
opacity: 0; | ||
} | ||
} | ||
|
||
@keyframes zoomIn { | ||
0% {transform: scale(0.9);} | ||
100% {transform: scale(1);} | ||
0% { | ||
transform: scale(0.9); | ||
} | ||
100% { | ||
transform: scale(1); | ||
} | ||
} | ||
|
||
@keyframes zoomOut { | ||
0% {transform: scale(1);} | ||
100% {transform: scale(0.9);} | ||
} | ||
0% { | ||
transform: scale(1); | ||
} | ||
100% { | ||
transform: scale(0.9); | ||
} | ||
} | ||
|
||
/***** INPUT FILED ERROR ****/ | ||
.error-input input { | ||
box-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) #f87171; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,5 @@ | |
</div> | ||
|
||
</div> | ||
|
||
{% include "/responses/remove-403-login.html" %} |
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,15 @@ | ||
<p | ||
id="username-helper-text" | ||
hx-swap-oob="outerHTML" | ||
class="flex-inline text-sm text-red-400" | ||
> | ||
{{ err_msg }} | ||
</p> | ||
|
||
<p | ||
id="password-helper-text" | ||
hx-swap-oob="outerHTML" | ||
class="flex-inline text-sm text-red-400" | ||
> | ||
{{ err_msg }} | ||
</p> |
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,14 @@ | ||
<p | ||
id="username-helper-text" | ||
hx-swap-oob="outerHTML" | ||
hx-on:htmx:load="htmx.removeClass(htmx.find('form'), 'error-input')" | ||
hidden | ||
> | ||
</p> | ||
|
||
<p | ||
id="password-helper-text" | ||
hx-swap-oob="outerHTML" | ||
hidden | ||
> | ||
</p> |
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.