2A la suite

This commit is contained in:
batche
2022-12-07 20:38:11 +01:00
parent 081a3c1dc2
commit 365bac36ef
3 changed files with 4 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ import { UsersService } from './users.service';
import { User } from './entities/user.entity'; import { User } from './entities/user.entity';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { storageForAvatar } from 'src/common/constants/constants'; import { storageForAvatar } from 'src/common/constants/constants';
import { use } from 'passport';
@Controller('user') @Controller('user')
@@ -66,12 +67,15 @@ export class UsersController {
console.log("DANS PATCH USERS"); console.log("DANS PATCH USERS");
const user = await this.usersService.update(req.user.id, usersUpdateDto); const user = await this.usersService.update(req.user.id, usersUpdateDto);
// const user : User = req.user; // const user : User = req.user;
if (user.isEnabledTwoFactorAuth === false && user.isTwoFactorAuthenticated === true)
this.usersService.setIsTwoFactorAuthenticatedWhenLogout(user.id);
console.log ("Enbale 2FA " + user.isEnabledTwoFactorAuth + " Is authenticated " + user.isTwoFactorAuthenticated); console.log ("Enbale 2FA " + user.isEnabledTwoFactorAuth + " Is authenticated " + user.isTwoFactorAuthenticated);
if (user.isEnabledTwoFactorAuth === true && user.isTwoFactorAuthenticated === false) if (user.isEnabledTwoFactorAuth === true && user.isTwoFactorAuthenticated === false)
{ {
console.log("On est dans la boucle de redirection 2FA / Au niveau de l'update du user") console.log("On est dans la boucle de redirection 2FA / Au niveau de l'update du user")
return response.status(200).redirect("http://transcendance:8080/#/2fa"); return response.status(200).redirect("http://transcendance:8080/#/2fa");
} }
return response.status(200).redirect("http://transcendance:8080/#/profile")
} }
@UseGuards(AuthenticateGuard) @UseGuards(AuthenticateGuard)

View File

@@ -48,7 +48,6 @@
wrongCode = `Wrong code`; wrongCode = `Wrong code`;
} }
if (response.status === 200) { if (response.status === 200) {
// userLogout();
push('/profile'); push('/profile');
console.log('valid Code for 2FA') console.log('valid Code for 2FA')
} }

View File

@@ -77,7 +77,6 @@
.then(response => response.json()) .then(response => response.json())
// .then((result) => console.log(result)) // .then((result) => console.log(result))
// .then(() => console.log('successful sub of new settings')) // .then(() => console.log('successful sub of new settings'))
} }
}; };