refactor(auth): remove commented code in OAuth2 callback component
All checks were successful
CI / Get Changed Files (pull_request) Successful in 11s
CI / eslint (pull_request) Successful in 38s
CI / oxlint (pull_request) Successful in 45s
CI / prettier (pull_request) Successful in 48s
CI / Docker backend validation (pull_request) Successful in 49s
CI / Docker frontend validation (pull_request) Successful in 1m15s
CI / test-build (pull_request) Successful in 1m12s
CI / Checkstyle Main (pull_request) Successful in 1m26s
All checks were successful
CI / Get Changed Files (pull_request) Successful in 11s
CI / eslint (pull_request) Successful in 38s
CI / oxlint (pull_request) Successful in 45s
CI / prettier (pull_request) Successful in 48s
CI / Docker backend validation (pull_request) Successful in 49s
CI / Docker frontend validation (pull_request) Successful in 1m15s
CI / test-build (pull_request) Successful in 1m12s
CI / Checkstyle Main (pull_request) Successful in 1m26s
This commit is contained in:
parent
52de53878e
commit
756beb5a4e
1 changed files with 0 additions and 8 deletions
|
@ -29,17 +29,14 @@ export class OAuth2CallbackComponent implements OnInit {
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
// Check for code in URL params
|
|
||||||
this.route.queryParams.subscribe((params) => {
|
this.route.queryParams.subscribe((params) => {
|
||||||
const code = params['code'];
|
const code = params['code'];
|
||||||
const provider = this.route.snapshot.data['provider'] || 'github';
|
const provider = this.route.snapshot.data['provider'] || 'github';
|
||||||
|
|
||||||
if (code) {
|
if (code) {
|
||||||
if (provider === 'google') {
|
if (provider === 'google') {
|
||||||
// Exchange Google code for a JWT token
|
|
||||||
this.authService.googleAuth(code).subscribe({
|
this.authService.googleAuth(code).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
// Redirect to home after successful authentication
|
|
||||||
this.router.navigate(['/home']);
|
this.router.navigate(['/home']);
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
|
@ -47,17 +44,14 @@ export class OAuth2CallbackComponent implements OnInit {
|
||||||
this.error = err.error?.message || 'Authentication failed. Please try again.';
|
this.error = err.error?.message || 'Authentication failed. Please try again.';
|
||||||
console.log('Error details:', err);
|
console.log('Error details:', err);
|
||||||
|
|
||||||
// Redirect back to landing page after showing error
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Exchange GitHub code for a JWT token
|
|
||||||
this.authService.githubAuth(code).subscribe({
|
this.authService.githubAuth(code).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
// Redirect to home after successful authentication
|
|
||||||
this.router.navigate(['/home']);
|
this.router.navigate(['/home']);
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
|
@ -65,7 +59,6 @@ export class OAuth2CallbackComponent implements OnInit {
|
||||||
this.error = err.error?.message || 'Authentication failed. Please try again.';
|
this.error = err.error?.message || 'Authentication failed. Please try again.';
|
||||||
console.log('Error details:', err);
|
console.log('Error details:', err);
|
||||||
|
|
||||||
// Redirect back to landing page after showing error
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
@ -75,7 +68,6 @@ export class OAuth2CallbackComponent implements OnInit {
|
||||||
} else {
|
} else {
|
||||||
this.error = 'Authentication failed. No authorization code received.';
|
this.error = 'Authentication failed. No authorization code received.';
|
||||||
|
|
||||||
// Redirect back to landing page after showing error
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
Reference in a new issue