update des cookies pour le déploiement sur le domaine
This commit is contained in:
parent
789bbbf81d
commit
50179801b1
@ -64,7 +64,9 @@
|
||||
"serve": {
|
||||
"options": {
|
||||
"host": "0.0.0.0",
|
||||
"allowedHosts": ["abonentendeur.guams.fr"]
|
||||
"allowedHosts": [
|
||||
"abonentendeur.guams.fr"
|
||||
]
|
||||
},
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": {
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"domain": "localhost",
|
||||
"serverAddress": "localhost",
|
||||
"apiURL": "http://localhost:8080/api",
|
||||
"tokenTTL": 36000000
|
||||
|
@ -6,6 +6,10 @@ import * as config from '../../configuration.json'
|
||||
})
|
||||
export class ConfigurationService {
|
||||
|
||||
getDomain(): string {
|
||||
return config.domain;
|
||||
}
|
||||
|
||||
getApiUrl(): string {
|
||||
return config.apiURL
|
||||
}
|
||||
|
@ -45,8 +45,9 @@ export class LoginComponent implements OnDestroy {
|
||||
(
|
||||
this.authorService.login(this.name, this.password).pipe(
|
||||
switchMap((tokenObj: any) => {
|
||||
this.cookieService.delete('token', '/', this.configurationService.getServerAddress())
|
||||
this.cookieService.delete('token', '/', this.configurationService.getDomain())
|
||||
this.cookieService.set("token", tokenObj.token, {
|
||||
domain: this.configurationService.getDomain(),
|
||||
secure: true,
|
||||
path: '/'
|
||||
});
|
||||
@ -54,11 +55,13 @@ export class LoginComponent implements OnDestroy {
|
||||
}))
|
||||
.subscribe({
|
||||
next: (author: Author) => {
|
||||
this.cookieService.delete('author', '/', this.configurationService.getServerAddress())
|
||||
this.cookieService.delete('author', '/', this.configurationService.getDomain())
|
||||
this.cookieService.set("author", JSON.stringify(author), {
|
||||
domain: this.configurationService.getDomain(),
|
||||
secure : true,
|
||||
path: '/' });
|
||||
this.cookieService.set('token-expiration-date', DateTime.now().plus({millisecond: this.configurationService.getTokenTTL()}).toISO(), {
|
||||
domain: this.configurationService.getDomain(),
|
||||
secure: true,
|
||||
path: '/',
|
||||
})
|
||||
|
@ -24,7 +24,7 @@ export class LogoutComponent implements OnInit{
|
||||
const routes: string[] = ['/', '/login', '/register', '/logout', '/profile', '/post', '/new-post', '/admin']
|
||||
Object.keys(this.cookieService.getAll()).forEach(key => {
|
||||
routes.forEach(route => {
|
||||
this.cookieService.delete(key, route, this.configurationService.getServerAddress());
|
||||
this.cookieService.delete(key, route, this.configurationService.getDomain());
|
||||
})
|
||||
});
|
||||
this.router.navigate(['/']).then(() => this.successMessage('Déconnexion', 'Vous avez été deconnecté avec succès'));
|
||||
|
@ -1,5 +1,6 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>A BON ENTENDEUR</title>
|
||||
@ -7,17 +8,20 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="icon.jpg">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
<footer class="footer">
|
||||
<p class="footer-creator">Site web réalisé par <strong>Guams</strong>.</p>
|
||||
<p class="footer-banner">Bannière réalisée par <a href="https://x.com/Orabisss" target="_blank" class="footer-link">@Orabisss</a> sur Twitter.</p>
|
||||
<p class="footer-follow">Suivez-moi sur :</p>
|
||||
<p class="footer-links">
|
||||
<a href="https://x.com/Guams8" target="_blank" class="footer-link">Twitter</a>
|
||||
<a href="https://github.com/Guamss" target="_blank" class="footer-link">GitHub</a>
|
||||
</p>
|
||||
<p class="footer-copyright">© 2024 Guams. Tous droits réservés.</p>
|
||||
</footer>
|
||||
<app-root></app-root>
|
||||
<footer class="footer">
|
||||
<p class="footer-creator">Site web réalisé par <strong>Guams</strong>.</p>
|
||||
<p class="footer-banner">Bannière réalisée par <a href="https://x.com/Orabisss" target="_blank"
|
||||
class="footer-link">@Orabisss</a> sur Twitter.</p>
|
||||
<p class="footer-follow">Suivez-moi sur :</p>
|
||||
<p class="footer-links">
|
||||
<a href="https://x.com/Guams8" target="_blank" class="footer-link">Twitter</a>
|
||||
<a href="https://github.com/Guamss" target="_blank" class="footer-link">GitHub</a>
|
||||
<a href="https://gitea.guams.fr" target="_blank" class="footer-link">Gitea</a>
|
||||
</p>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user