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)
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
wrongCode = `Wrong code`;
|
||||
}
|
||||
if (response.status === 200) {
|
||||
// userLogout();
|
||||
push('/profile');
|
||||
console.log('valid Code for 2FA')
|
||||
}
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
.then(response => response.json())
|
||||
// .then((result) => console.log(result))
|
||||
// .then(() => console.log('successful sub of new settings'))
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user