trying to work out 2fa

This commit is contained in:
Me
2022-12-07 12:12:33 +01:00
parent baa9465018
commit 1a584483e7
2 changed files with 3 additions and 15 deletions

View File

@@ -7,7 +7,7 @@ import { ConfigModule } from '@nestjs/config';
import { FriendshipsModule } from './friendship/friendships.module';
import { AuthenticationModule } from './auth/42/authentication.module';
import { PassportModule } from '@nestjs/passport';
import { GameModule } from './game/game/game.module';
// import { GameModule } from './game/game/game.module';
@Module({
imports: [UsersModule,
@@ -27,7 +27,7 @@ import { GameModule } from './game/game/game.module';
//avec une classe pour le module
synchronize: true,
}),
GameModule,
// GameModule,
],
controllers: [AppController],
providers: [AppService],

View File

@@ -20,7 +20,6 @@
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",
{
@@ -46,18 +45,7 @@
});
if (response.status === 401) {
qrCode = "";
wrongCode = `Wrong code, you have ${maxTry} tries left`;
maxTry--;
}
if (maxTry === 0) {
await fetch("http://transcendance:8080/auth/logout",
{
method : 'POST',
})
.then(response => response.json())
// .then(push('/'));
push('/');
// The .then(push) doesn't seem to work...
wrongCode = `Wrong code`;
}
if (response.status === 200) {
userLogout();