2A la suite
This commit is contained in:
@@ -10,6 +10,7 @@ import { UsersService } from './users.service';
|
||||
import { User } from './entities/user.entity';
|
||||
import { of } from 'rxjs';
|
||||
import { storageForAvatar } from 'src/common/constants/constants';
|
||||
import { use } from 'passport';
|
||||
|
||||
|
||||
@Controller('user')
|
||||
@@ -66,12 +67,15 @@ export class UsersController {
|
||||
console.log("DANS PATCH USERS");
|
||||
const user = await this.usersService.update(req.user.id, usersUpdateDto);
|
||||
// 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);
|
||||
if (user.isEnabledTwoFactorAuth === true && user.isTwoFactorAuthenticated === false)
|
||||
{
|
||||
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/#/profile")
|
||||
}
|
||||
|
||||
@UseGuards(AuthenticateGuard)
|
||||
|
||||
Reference in New Issue
Block a user