Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 | 1x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 1x 39x 5x 5x 103x 4x 4x 4x 1x 1x 1x 1x 1x 1x 5x 5x 5x 1x 6x 9x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 2x 1x 3x 3x 3x 1x 1x 1x 1x 2x 2x 2x 3x 3x 3x 1x 1x 1x 1x 2x 2x 2x 7x 7x 3x 2x 1x 4x 3x 1x 2x 1x 1x 1x 3x | import { Component, signal, inject, OnInit, AfterViewInit, OnDestroy } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Router, RouterModule } from '@angular/router';
import { AuthService } from '../services/auth.service';
import { UserService } from '../services/user.service';
import { OAuthService } from '../services/oauth.service';
import { TurnstileService } from '../services/turnstile.service';
import { RegisterRequest } from '../models';
import { oauthConfig } from '../config/oauth.config';
import { RgpdConsentModalComponent } from './rgpd-consent-modal.component';
import { GoogleAnalyticsService } from '../services/google-analytics.service';
@Component({
selector: 'app-register',
standalone: true,
imports: [CommonModule, FormsModule, RouterModule, RgpdConsentModalComponent],
template: `
<div class="register-container">
<div class="register-content">
<h1 class="register-title">Créez votre compte</h1>
<p class="register-subtitle">
Déjà un compte ?
<a routerLink="/login" class="login-link">Connectez-vous</a>
</p>
<div class="register-layout">
<!-- Left Side: Social Login -->
<div class="social-section">
<h2 class="section-title">Inscription rapide</h2>
<div class="social-login">
<button class="social-btn google-btn" (click)="registerWithGoogle()" [disabled]="isLoading()">
<img src="https://www.google.com/favicon.ico" alt="Google" class="social-logo" onerror="this.style.display='none'; this.nextElementSibling.style.display='flex';">
<span class="social-icon-fallback">G</span>
Continuer avec Google
</button>
<button class="social-btn facebook-btn" (click)="registerWithFacebook()" [disabled]="isLoading()">
<svg class="social-logo" viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
<path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/>
</svg>
Continuer avec Facebook
</button>
</div>
</div>
<!-- Divider -->
<div class="vertical-divider"></div>
<!-- Right Side: Registration Form -->
<div class="form-section">
<h2 class="section-title">Inscription classique</h2>
<form class="registration-form" (ngSubmit)="onSubmit()">
<div class="form-group">
<label for="firstName">Prénom</label>
<input
type="text"
id="firstName"
[(ngModel)]="formData.firstName"
name="firstName"
class="form-input"
placeholder="Votre prénom"
required
/>
</div>
<div class="form-group">
<label for="lastName">Nom</label>
<input
type="text"
id="lastName"
[(ngModel)]="formData.lastName"
name="lastName"
class="form-input"
placeholder="Votre nom"
required
/>
</div>
<div class="form-group">
<label for="email">Email</label>
<input
type="email"
id="email"
[(ngModel)]="formData.email"
name="email"
class="form-input"
placeholder="votre.email@example.com"
required
/>
</div>
<div class="form-group">
<label for="birthDate">Date de naissance</label>
<div class="date-input-wrapper">
<input
type="date"
id="birthDate"
[(ngModel)]="formData.birthDate"
name="birthDate"
class="form-input date-input"
[max]="todayDate"
/>
</div>
</div>
<div class="form-group">
<label for="password">Mot de passe</label>
<input
type="password"
id="password"
[(ngModel)]="formData.password"
name="password"
class="form-input"
placeholder="Votre mot de passe"
required
minlength="6"
/>
</div>
<!-- Cloudflare Turnstile -->
<div class="form-group captcha-group">
<label>Vérification anti-robot</label>
<div id="turnstile-container" class="turnstile-wrapper"></div>
<div *ngIf="captchaError()" class="captcha-error">
{{ captchaError() }}
</div>
<small class="captcha-info">
Cette vérification permet de protéger le site contre les robots et les abus.
</small>
</div>
<!-- RGPD Consent -->
<div class="form-group consent-group">
<div class="consent-box">
<label class="consent-label">
<input
type="checkbox"
[(ngModel)]="formData.consentGiven"
name="consentGiven"
class="consent-checkbox"
/>
<span class="consent-text">
J'accepte de recevoir des communications marketing par email
</span>
</label>
<small class="consent-info">
<span class="rgpd-badge">RGPD</span>
Vous pouvez modifier ce choix à tout moment dans vos paramètres de profil.
</small>
</div>
</div>
<!-- Error Message -->
<div *ngIf="errorMessage()" class="error-message">
{{ errorMessage() }}
</div>
<button type="submit" class="submit-btn" [disabled]="isLoading() || !isFormValid()">
<span *ngIf="!isLoading()">S'inscrire</span>
<span *ngIf="isLoading()">Inscription en cours...</span>
</button>
</form>
</div>
</div>
<!-- Error Message - Fixed bottom right -->
<div *ngIf="errorMessage()" class="error-notification">
<div class="error-text">{{ errorMessage() }}</div>
</div>
<!-- Modal de consentement RGPD pour OAuth -->
<app-rgpd-consent-modal
*ngIf="showRgpdModal()"
(confirmed)="onRgpdConsentConfirmed($event)"
></app-rgpd-consent-modal>
</div>
</div>
`,
styles: [`
.register-container {
min-height: 100vh;
background: var(--very-light-green);
display: flex;
align-items: center;
justify-content: center;
padding: 1.5rem;
}
.register-content {
background: white;
border-radius: 20px;
padding: 2rem;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
max-width: 1000px;
width: 100%;
}
.register-layout {
display: grid;
grid-template-columns: 1fr auto 1fr;
gap: 2rem;
align-items: start;
margin-top: 1.5rem;
}
.social-section,
.form-section {
display: flex;
flex-direction: column;
position: relative;
}
.section-title {
font-size: 1rem;
font-weight: 600;
color: var(--dark-gray);
margin-bottom: 1rem;
text-align: center;
padding-bottom: 0.75rem;
border-bottom: 2px solid var(--very-light-green);
}
.vertical-divider {
width: 2px;
background: linear-gradient(to bottom, transparent, var(--light-gray), transparent);
min-height: 400px;
align-self: stretch;
margin: 0 0.5rem;
}
.register-title {
font-size: 1.5rem;
font-weight: 700;
color: var(--dark-gray);
text-align: center;
margin-bottom: 0.25rem;
}
.register-subtitle {
color: var(--dark-gray);
text-align: center;
margin-bottom: 1rem;
font-size: 0.9rem;
}
.login-link {
color: var(--secondary-green);
text-decoration: none;
font-weight: 600;
}
.login-link:hover {
text-decoration: underline;
}
.social-login {
display: flex;
flex-direction: column;
gap: 0.6rem;
}
.social-btn {
display: flex;
align-items: center;
justify-content: center;
gap: 0.75rem;
padding: 0.75rem 1.25rem;
border: 2px solid var(--light-gray);
border-radius: 10px;
background: white;
color: var(--dark-gray);
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.social-btn:hover {
border-color: var(--secondary-green);
background: var(--very-light-green);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(76, 175, 80, 0.15);
}
.social-logo {
width: 20px;
height: 20px;
flex-shrink: 0;
}
.social-icon-fallback {
width: 24px;
height: 24px;
border-radius: 50%;
display: none;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 0.9rem;
background: linear-gradient(45deg, #ea4335, #fbbc05, #34a853, #4285f4);
color: white;
}
.google-btn .social-logo {
width: 20px;
height: 20px;
}
.facebook-btn .social-logo {
width: 20px;
height: 20px;
color: #1877f2;
}
.registration-form {
display: flex;
flex-direction: column;
gap: 0.9rem;
}
.form-group {
display: flex;
flex-direction: column;
gap: 0.4rem;
}
.form-group label {
color: var(--dark-gray);
font-weight: 500;
font-size: 0.85rem;
}
.form-input {
padding: 0.75rem 1rem;
border: 2px solid var(--light-gray);
border-radius: 8px;
font-size: 0.9rem;
transition: all 0.3s ease;
background: white;
}
.form-input:focus {
outline: none;
border-color: var(--secondary-green);
background: var(--very-light-green);
box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}
.date-input-wrapper {
position: relative;
display: flex;
align-items: center;
}
.date-input {
padding-right: 3rem; /* Space for the icon */
}
.date-input::-webkit-calendar-picker-indicator {
background: transparent;
bottom: 0;
color: transparent;
cursor: pointer;
height: auto;
left: 0;
position: absolute;
right: 0;
top: 0;
width: auto;
}
.date-input::-webkit-inner-spin-button,
.date-input::-webkit-clear-button {
display: none;
}
.date-input-wrapper::after {
content: '📅'; /* Calendar icon */
position: absolute;
right: 1rem;
color: var(--secondary-green);
font-size: 1.2rem;
pointer-events: none; /* Allow clicks to pass through to the native picker */
}
.submit-btn {
background: linear-gradient(135deg, var(--secondary-green), #45a049);
color: white;
border: none;
padding: 0.875rem 1.5rem;
border-radius: 10px;
font-size: 0.95rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
margin-top: 0.5rem;
box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}
.submit-btn:hover:not(:disabled) {
background: #45a049;
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}
.submit-btn:disabled {
background: var(--light-gray);
color: var(--dark-gray);
cursor: not-allowed;
transform: none;
}
.error-notification {
position: fixed;
bottom: 2rem;
right: 2rem;
background: rgba(231, 76, 60, 0.95);
border: 2px solid rgba(231, 76, 60, 0.5);
color: white;
padding: 1.25rem 1.5rem;
border-radius: 12px;
font-size: 0.9rem;
box-shadow: 0 8px 24px rgba(231, 76, 60, 0.3);
max-width: 400px;
z-index: 1000;
animation: slideInRight 0.3s ease-out;
}
@keyframes slideInRight {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
.error-text {
line-height: 1.5;
margin: 0;
}
.consent-group {
margin-top: 0.3rem;
}
.consent-box {
background: var(--very-light-green);
border: 1px solid var(--light-gray);
border-radius: 8px;
padding: 0.75rem;
}
.consent-label {
display: flex;
align-items: flex-start;
gap: 0.6rem;
cursor: pointer;
font-size: 0.85rem;
line-height: 1.4;
margin-bottom: 0.4rem;
}
.consent-checkbox {
margin-top: 0.15rem;
width: 18px;
height: 18px;
cursor: pointer;
flex-shrink: 0;
accent-color: var(--secondary-green);
}
.consent-text {
color: var(--dark-gray);
flex: 1;
font-weight: 500;
}
.consent-info {
display: flex;
align-items: center;
gap: 0.4rem;
color: var(--gray);
font-size: 0.75rem;
padding-left: 1.5rem;
line-height: 1.3;
}
.rgpd-badge {
background: var(--secondary-green);
color: white;
padding: 0.2rem 0.5rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
}
.captcha-group {
margin-top: 0.5rem;
}
.turnstile-wrapper {
display: flex;
justify-content: center;
margin: 0.5rem 0;
min-height: 65px; /* Hauteur minimale pour éviter le saut de layout */
}
.captcha-error {
color: #d32f2f;
font-size: 0.8rem;
margin-top: 0.5rem;
padding-left: 0.5rem;
text-align: center;
}
.captcha-info {
display: block;
color: var(--gray);
font-size: 0.75rem;
margin-top: 0.5rem;
text-align: center;
line-height: 1.4;
}
/* Responsive */
@media (max-width: 768px) {
.register-container {
padding: 1rem;
}
.register-content {
padding: 2rem;
max-width: 100%;
}
.register-title {
font-size: 1.8rem;
}
.register-layout {
grid-template-columns: 1fr;
gap: 2rem;
}
.vertical-divider {
display: none;
}
.social-section {
order: 2;
}
.form-section {
order: 1;
}
}
@media (max-width: 480px) {
.register-content {
padding: 1.5rem;
}
.social-btn {
padding: 0.8rem 1.2rem;
font-size: 0.9rem;
}
.form-input {
padding: 0.8rem 1rem;
}
.submit-btn {
padding: 1rem 1.5rem;
font-size: 1rem;
}
}
`]
})
export class RegisterComponent implements OnInit, AfterViewInit, OnDestroy {
private authService = inject(AuthService);
private userService = inject(UserService);
private oauthService = inject(OAuthService);
private turnstileService = inject(TurnstileService);
private router = inject(Router);
private ga = inject(GoogleAnalyticsService);
isLoading = signal(false);
errorMessage = signal('');
showRgpdModal = signal(false);
private turnstileWidgetId: string | null = null;
// IDs OAuth depuis la configuration
private readonly GOOGLE_CLIENT_ID = oauthConfig.google.clientId;
private readonly FACEBOOK_APP_ID = oauthConfig.facebook.appId;
formData = {
firstName: '',
lastName: '',
email: '',
birthDate: '',
password: '',
consentGiven: false
};
todayDate: string = '';
captchaError = signal('');
turnstileToken = signal<string>('');
ngOnInit() {
// Initialiser la date maximale (aujourd'hui) pour le date picker
this.todayDate = new Date().toISOString().split('T')[0];
}
ngAfterViewInit() {
// Attendre que Turnstile soit chargé avant de l'initialiser
this.initTurnstile();
}
ngOnDestroy() {
// Supprimer le widget Turnstile lors de la destruction du composant
if (this.turnstileWidgetId) {
this.turnstileService.remove(this.turnstileWidgetId);
}
}
/**
* Initialise Cloudflare Turnstile
*/
private initTurnstile() {
// Attendre que le script Turnstile soit chargé
const checkTurnstile = setInterval(() => {
if (this.turnstileService.isLoaded()) {
clearInterval(checkTurnstile);
try {
this.turnstileWidgetId = this.turnstileService.render(
'turnstile-container',
(token: string) => {
// Callback quand l'utilisateur complète la vérification
this.turnstileToken.set(token);
this.captchaError.set('');
},
(error: any) => {
// Callback en cas d'erreur
this.turnstileToken.set('');
this.captchaError.set(error.message || 'Erreur lors de la vérification. Veuillez réessayer.');
}
);
} catch (error) {
console.error('Erreur lors de l\'initialisation de Turnstile:', error);
this.captchaError.set('Erreur lors du chargement de la vérification. Veuillez rafraîchir la page.');
}
}
}, 100);
// Timeout après 10 secondes
setTimeout(() => {
clearInterval(checkTurnstile);
if (!this.turnstileService.isLoaded()) {
this.captchaError.set('Impossible de charger la vérification. Veuillez vérifier votre connexion internet.');
}
}, 10000);
}
/**
* Vérifie si Turnstile est valide
*/
isCaptchaValid(): boolean {
return !!this.turnstileToken() && this.turnstileToken().length > 0;
}
/**
* Vérifie si le formulaire est valide (tous les champs requis sont remplis)
*/
isFormValid(): boolean {
return !!(
this.formData.firstName &&
this.formData.firstName.trim() &&
this.formData.lastName &&
this.formData.lastName.trim() &&
this.formData.email &&
this.formData.email.trim() &&
this.formData.password &&
this.formData.password.trim().length >= 6 &&
this.isCaptchaValid()
);
}
onSubmit() {
Iif (!this.formData.firstName || !this.formData.lastName || !this.formData.email || !this.formData.password) {
this.errorMessage.set('Veuillez remplir tous les champs');
return;
}
Iif (this.formData.password.length < 6) {
this.errorMessage.set('Le mot de passe doit contenir au moins 6 caractères');
return;
}
// Vérifier le captcha
Iif (!this.isCaptchaValid()) {
this.captchaError.set('Veuillez compléter la vérification anti-robot.');
return;
}
this.isLoading.set(true);
this.errorMessage.set('');
// Le backend n'accepte que username, email et password pour l'inscription
const registerData: RegisterRequest = {
username: this.formData.email.split('@')[0] || this.formData.email,
email: this.formData.email,
password: this.formData.password
};
this.authService.register(registerData).subscribe({
next: (response) => {
this.isLoading.set(false);
this.emitSignupComplete('email');
// Mettre à jour le profil avec firstName et lastName après inscription
if (response.user?.id) {
this.updateUserProfile(response.user.id);
} else E{
this.router.navigate(['/game']);
}
},
error: (error) => {
this.isLoading.set(false);
const errorMsg = error.error?.error || error.error?.message || 'Erreur lors de l\'inscription. Veuillez réessayer.';
console.log('RegisterComponent error:', error, 'Extracted message:', errorMsg);
this.errorMessage.set(errorMsg);
}
});
}
private updateUserProfile(userId: number) {
// Mettre à jour le profil avec firstName, lastName, birthDate et consentement après inscription
const updateData: any = {
firstName: this.formData.firstName,
lastName: this.formData.lastName,
consentGiven: this.formData.consentGiven
};
// Ajouter la date de naissance si elle est renseignée
if (this.formData.birthDate) {
updateData.birthDate = this.formData.birthDate;
}
this.userService.updatePartialUser(userId, updateData).subscribe({
next: () => {
this.router.navigate(['/game']);
},
error: (error) => {
// Rediriger quand même vers le jeu même si la mise à jour échoue
this.router.navigate(['/game']);
}
});
}
registerWithGoogle() {
this.isLoading.set(true);
this.errorMessage.set('');
return this.oauthService.loginWithGoogle(this.GOOGLE_CLIENT_ID)
.then(() => {
this.isLoading.set(false);
this.emitSignupComplete('google');
// Attendre un peu pour que l'utilisateur soit bien chargé
setTimeout(() => {
// Vérifier si le consentement RGPD a été donné
this.checkRgpdConsent();
}, 300);
})
.catch((error) => {
this.isLoading.set(false);
const errorMsg = error.error?.error || error.message || 'Erreur lors de l\'inscription avec Google';
this.errorMessage.set(errorMsg);
});
}
registerWithFacebook() {
this.isLoading.set(true);
this.errorMessage.set('');
return this.oauthService.loginWithFacebook(this.FACEBOOK_APP_ID)
.then(() => {
this.isLoading.set(false);
this.emitSignupComplete('facebook');
// Attendre un peu pour que l'utilisateur soit bien chargé
setTimeout(() => {
// Vérifier si le consentement RGPD a été donné
this.checkRgpdConsent();
}, 300);
})
.catch((error) => {
this.isLoading.set(false);
const errorMsg = error.error?.error || error.message || 'Erreur lors de l\'inscription avec Facebook';
this.errorMessage.set(errorMsg);
});
}
checkRgpdConsent() {
// Pour une inscription OAuth, on affiche toujours la modal RGPD
// sauf si l'utilisateur a déjà explicitement donné son consentement (true)
const currentUser = this.authService.getCurrentUserSync();
if (currentUser) {
// Si consentGiven n'est pas explicitement true, afficher la modal
if (currentUser.consentGiven !== true) {
this.showRgpdModal.set(true);
} else {
// Consentement déjà donné, rediriger vers le jeu
this.router.navigate(['/game']);
}
} else {
// Récupérer l'utilisateur depuis le backend
this.authService.getCurrentUser().subscribe({
next: (user) => {
// Si consentGiven n'est pas explicitement true, afficher la modal
if (user.consentGiven !== true) {
this.showRgpdModal.set(true);
} else {
this.router.navigate(['/game']);
}
},
error: (error) => {
// En cas d'erreur, afficher quand même la modal pour être sûr
this.showRgpdModal.set(true);
}
});
}
}
onRgpdConsentConfirmed(consentGiven: boolean) {
this.showRgpdModal.set(false);
// Rediriger vers le jeu après avoir donné le consentement
this.router.navigate(['/game']);
}
private emitSignupComplete(method: string) {
this.ga.sendEvent('signup_complete', { method });
}
}
|