oops i did some work directly on master, but it's still stable so should be fine

This commit is contained in:
Me
2022-12-01 16:27:56 +01:00
parent 4cff63e264
commit f8095c7ec6
3 changed files with 26 additions and 21 deletions

View File

@@ -34,7 +34,7 @@ export class AuthenticationController {
console.log('ON EST DANS REDIRECT AUTH CONTROLLER');
console.log('On redirige');
if (request.user.isEnabledTwoFactorAuth === false)
return response.status(200).redirect('http://transcendance:8080/');
return response.status(200).redirect('http://transcendance:8080/#/profile');
return response.status(200).redirect('http://transcendance:8080/#/2fa');
}
@@ -74,6 +74,9 @@ export class AuthenticationController {
}
await this.userService.enableTwoFactorAuth(request.user.id);
console.log('ON REDIRIGE');
return response.status(200);
// return response.status(200);
// return 200;
// needs to be looked at by Cherif
return response.status(200).redirect('http://transcendance:8080/');
}
}

View File

@@ -19,6 +19,7 @@
let qrCodeImg;
let qrCode = "";
let wrongCode = "";
// max try doesn't work if you reste the page
let maxTry = 3;
const fetchQrCodeImg = (async() => {
await fetch("http://transcendance:8080/api/v2/auth/2fa/generate",
@@ -61,6 +62,7 @@
if (response.status === 200) {
// loginStatus.toggleTFA();
loginStatus.update( (old) => ({...old, tfa: true}) );
//
push('/profile');
console.log('vaid Code for 2FA')
}

View File

@@ -60,32 +60,32 @@ import { get } from 'svelte/store';
// }
// ]
// }),
// and example
// '/profile': wrap({
// // Use a dynamically-loaded component for this
// asyncComponent: () => import('./ProfilePage.svelte'),
// // Adding one pre-condition that's an async function
// conditions: [
// async (detail) => {
// // Make a network request, which are async operations
// const response = await fetch('http://transcendance:8080/api/v2/user')
// const data = await response.json()
// // Return true to continue loading the component, or false otherwise
// if (data.isAdmin) {
// return true
// }
// else {
// return false
// }
// }
// ]
// }),
// // Use a dynamically-loaded component for this
// asyncComponent: () => import('./ProfilePage.svelte'),
// // Adding one pre-condition that's an async function
// conditions: [
// async (detail) => {
// // Make a network request, which are async operations
// const response = await fetch('http://transcendance:8080/api/v2/user')
// const data = await response.json()
// // Return true to continue loading the component, or false otherwise
// if (data.isAdmin) {
// return true
// }
// else {
// return false
// }
// }
// ]
// }),
// '/unauthorized-access': UnauthorizedAccessPage,
// '*': NotFound
// };
export const primaryRoutes = {
"/": SplashPage,
'/2fa': TwoFactorAuthentication,
"/profile": ProfilePage,
"/profile/*": ProfilePage,
'/unauthorized-access': UnauthorizedAccessPage,