-
-
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.
Add logout functionality and error page customization
Implemented a logout component with associated service methods and UI elements. Added a custom 500 error page and styled it accordingly. Enhanced route guards to check for permissions and introduced local storage for theme persistence.
- Loading branch information
Showing
17 changed files
with
307 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" > | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Error 500</title> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> | ||
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=IBM+Plex+Mono:400|Oswald:600'> | ||
<link rel="stylesheet" href="./style.css"> | ||
</head> | ||
|
||
<body> | ||
<div id="error">Error</div> | ||
<div class="error-num">500 | ||
<div class="error-num__clip">500</div> | ||
</div> | ||
<p id="desc">Uh oh, there seems to be a problem.</p> | ||
<p>Let me help you find <a href="http://michibaum.ch" target="_blank">a way out</a></p> | ||
|
||
</body> | ||
</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,127 @@ | ||
:root { | ||
font-size: 20px; | ||
font-family: "IBM Plex Mono"; | ||
line-height: 1.5; | ||
color: rgba(255, 255, 255, 0.25); | ||
} | ||
|
||
body { | ||
height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
text-align: center; | ||
background: #333333; | ||
} | ||
|
||
a { | ||
color: white; | ||
display: inline; | ||
} | ||
|
||
#error { | ||
margin-bottom: 1rem; | ||
font-size: 2rem; | ||
font-weight: 500; | ||
text-transform: uppercase; | ||
letter-spacing: 0.075em; | ||
color: #C94D4D; | ||
-webkit-animation: pulse 4s infinite alternate; | ||
animation: pulse 4s infinite alternate; | ||
position: relative; | ||
} | ||
@-webkit-keyframes pulse { | ||
from { | ||
opacity: 0.5; | ||
} | ||
50% { | ||
opacity: 0.5; | ||
} | ||
} | ||
@keyframes pulse { | ||
from { | ||
opacity: 0.5; | ||
} | ||
50% { | ||
opacity: 0.5; | ||
} | ||
} | ||
#error::before { | ||
content: ""; | ||
width: 0.75rem; | ||
height: 50vh; | ||
margin-bottom: 0.75em; | ||
position: absolute; | ||
left: 50%; | ||
bottom: 100%; | ||
transform: translateX(-50%); | ||
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 60%, transparent 100%); | ||
} | ||
|
||
#desc { | ||
margin: 2em 0 1em; | ||
} | ||
|
||
.error-num, .error-num__clip, .error-num__clip-left, .error-num__clip-left::before, .error-num__clip::before { | ||
position: relative; | ||
font-size: 10rem; | ||
font-family: "Oswald"; | ||
letter-spacing: -0.01em; | ||
color: white; | ||
-webkit-animation: colorSplit 1.25s steps(2, end) infinite; | ||
animation: colorSplit 1.25s steps(2, end) infinite; | ||
} | ||
@-webkit-keyframes colorSplit { | ||
25% { | ||
text-shadow: -0.02em 0 0 #ED008C, 0.025em 0 0 #0087EF; | ||
} | ||
75% { | ||
text-shadow: -0.035em 0 0 #ED008C, 0.04em 0 0 #0087EF; | ||
} | ||
} | ||
@keyframes colorSplit { | ||
25% { | ||
text-shadow: -0.02em 0 0 #ED008C, 0.025em 0 0 #0087EF; | ||
} | ||
75% { | ||
text-shadow: -0.035em 0 0 #ED008C, 0.04em 0 0 #0087EF; | ||
} | ||
} | ||
|
||
.error-num__clip, .error-num__clip-left, .error-num__clip-left::before, .error-num__clip::before { | ||
position: absolute; | ||
top: 0; | ||
left: -2px; | ||
z-index: 10; | ||
color: #333; | ||
overflow: visible; | ||
-webkit-clip-path: polygon(0% 0%, 100% 0, 100% 25%, 0 25%, 0 30%, 100% 30%, 100% 50%, 0 50%, 0 60%, 100% 60%, 100% 65%, 0 65%, 0 80%, 100% 80%, 100% 85%, 0 85%, 0% 0%); | ||
clip-path: polygon(0% 0%, 100% 0, 100% 25%, 0 25%, 0 30%, 100% 30%, 100% 50%, 0 50%, 0 60%, 100% 60%, 100% 65%, 0 65%, 0 80%, 100% 80%, 100% 85%, 0 85%, 0% 0%); | ||
-webkit-animation: glitch 1s steps(2, start) infinite; | ||
animation: glitch 1s steps(2, start) infinite; | ||
} | ||
@-webkit-keyframes glitch { | ||
30% { | ||
left: 0; | ||
} | ||
to { | ||
left: 0; | ||
} | ||
} | ||
@keyframes glitch { | ||
30% { | ||
left: 0; | ||
} | ||
to { | ||
left: 0; | ||
} | ||
} | ||
.error-num__clip::before, .error-num__clip-left::before { | ||
content: "500"; | ||
left: 0.05em; | ||
color: white; | ||
z-index: 9; | ||
-webkit-clip-path: polygon(0% 0%, 100% 0, 100% 26%, 0 26%, 0 29%, 100% 29%, 100% 51%, 0 51%, 0 59%, 100% 59%, 100% 66%, 0 66%, 0 79%, 100% 79%, 100% 86%, 0 86%, 0% 0%); | ||
clip-path: polygon(0% 0%, 100% 0, 100% 26%, 0 26%, 0 29%, 100% 29%, 100% 51%, 0 51%, 0 59%, 100% 59%, 100% 66%, 0 66%, 0 79%, 100% 79%, 100% 86%, 0 86%, 0% 0%); | ||
} |
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
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,20 +1,24 @@ | ||
import { CanActivateFn } from '@angular/router'; | ||
import {CanActivateFn} from '@angular/router'; | ||
import {inject} from "@angular/core"; | ||
import {AuthService} from "../services/auth.service"; | ||
import {PermissionService} from "../services/permission.service"; | ||
|
||
export const isAuthenticatedGuard: CanActivateFn = (route, state) => { | ||
let authService = inject(AuthService); | ||
return authService.isAuthenticated(route); | ||
return authService.isAuthenticated(); | ||
}; | ||
|
||
export const hasPermissionGuard: CanActivateFn = (route, state) => { | ||
// TODO get jwt && look at permissions | ||
// inject(PermissionsService).canActivate(inject(UserToken), route. params['id']); | ||
inject(PermissionService).hasAnyOf(route.params['id']) | ||
return true; | ||
let permissionService = inject(PermissionService); | ||
return permissionService.hasAnyOf(route.data['permissions']) | ||
}; | ||
|
||
export const isPermittedGuard: CanActivateFn = (route, state) => { | ||
return isAuthenticatedGuard(route, state) && hasPermissionGuard(route, state) | ||
const isAuthenticated = isAuthenticatedGuard(route, state) | ||
if(!isAuthenticated){ | ||
return false | ||
} | ||
|
||
return hasPermissionGuard(route, state) | ||
}; |
Oops, something went wrong.