Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 24 additions & 23 deletions backend/src/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import bcrypt from 'bcryptjs';
import bigInt from 'big-integer';
//import bigInt from 'big-integer';
import { sign, verify } from 'jsonwebtoken';
import type { EmailOptions } from '../types/email';
import { templateResetPassword } from '../email/email.registry';
import { compileTemplate } from '../email/email.renderer';
import * as auth_service from '../services/auth.service';
import * as banned_service from '../services/banned.service';
//import * as banned_service from '../services/banned.service';
import * as email_service from '../services/email.service';
import * as registration_service from '../services/registration.service';
import * as role_service from '../services/role.service';
Expand Down Expand Up @@ -58,27 +58,28 @@
const CASuser = await auth_service.validateCASTicket(ticket);

if (CASuser && CASuser.email && CASuser.givenName && CASuser.sn) {
// Assurez-vous que user.email est un string
let user = await user_service.getUserByEmail(CASuser.email.toLowerCase());
if (!user) {
const isBanned = await banned_service.getBannedByEmail(CASuser.email);

if (isBanned) {
Unauthorized(res, { msg: 'Unauthorized: user email prohibited' });
}

const password = bigInt.randBetween(bigInt(2).pow(255), bigInt(2).pow(256).minus(1)).toString();
await user_service.createUser(
CASuser.givenName,
CASuser.sn,
CASuser.email,
true,
'Student',
' ',
password,
);
user = await user_service.getUserByEmail(CASuser.email.toLowerCase());
}
// TEMPORAIRE POUR BLOQUER LA CREATION DE COMPTES NOUVEAUX
// remettre user en let
const user = await user_service.getUserByEmail(CASuser.email.toLowerCase());
// if (!user) {
// const isBanned = await banned_service.getBannedByEmail(CASuser.email);
//
// if (isBanned) {
// Unauthorized(res, { msg: 'Unauthorized: user email prohibited' });
// }
//
// const password = bigInt.randBetween(bigInt(2).pow(255), bigInt(2).pow(256).minus(1)).toString();
// await user_service.createUser(
// CASuser.givenName,
// CASuser.sn,
// CASuser.email,
// true,
// 'Student',
// ' ',
// password,
// );
// user = await user_service.getUserByEmail(CASuser.email.toLowerCase());
// }

const id = user?.id;

Expand Down Expand Up @@ -213,7 +214,7 @@

try {
// Vérifiez et décodez le token
const decoded: any = verify(token, jwtSecret);

Check warning on line 217 in backend/src/controllers/auth.controller.ts

View workflow job for this annotation

GitHub Actions / lint-api

Unexpected any. Specify a different type

// Trouvez l'utilisateur par ID
const user = await user_service.getUserById(decoded.userId);
Expand Down
12 changes: 6 additions & 6 deletions backend/src/services/permanence.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
permanence_id: permId,
});
});
} catch (error: any) {

Check warning on line 85 in backend/src/services/permanence.service.ts

View workflow job for this annotation

GitHub Actions / lint-api

Unexpected any. Specify a different type
// Gestion des erreurs de contraintes de base de données
if (
error.code === '23505' || // Contrainte unique PostgreSQL
Expand Down Expand Up @@ -652,19 +652,19 @@
permBeginDate: new Intl.DateTimeFormat('fr-FR', {
day: '2-digit',
month: 'long',
}).format(notification.permanence.start_at),
}).format(new Date(notification.permanence.start_at.getTime() + 2 * 3600000)),
permBeginHour: new Intl.DateTimeFormat('fr-FR', {
hour: '2-digit',
minute: '2-digit',
}).format(notification.permanence.start_at),
}).format(new Date(notification.permanence.start_at.getTime() + 2 * 3600000)),
permEndDate: new Intl.DateTimeFormat('fr-FR', {
day: '2-digit',
month: 'long',
}).format(notification.permanence.end_at),
}).format(new Date(notification.permanence.end_at.getTime() + 2 * 3600000)),
permEndHour: new Intl.DateTimeFormat('fr-FR', {
hour: '2-digit',
minute: '2-digit',
}).format(notification.permanence.end_at),
}).format(new Date(notification.permanence.end_at.getTime() + 2 * 3600000)),
permLocation: notification.permanence.location,
permDescription: notification.permanence.description,
};
Expand Down Expand Up @@ -701,13 +701,13 @@
month: 'long',
hour: '2-digit',
minute: '2-digit',
}).format(permanence.start_at),
}).format(new Date(permanence.start_at.getTime() + 2 * 3600000)),
endAt: new Intl.DateTimeFormat('fr-FR', {
day: '2-digit',
month: 'long',
hour: '2-digit',
minute: '2-digit',
}).format(permanence.end_at),
}).format(new Date(permanence.end_at.getTime() + 2 * 3600000)),
location: permanence.location,
})),
};
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/WEI_SDI_Food/foodSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ export const FoodSection = () => {
</div>
) : (
<>
<div className="surface-card overflow-hidden">
{/* <div className="surface-card overflow-hidden">
<iframe
title="Billetterie Repas"
src="https://www.billetweb.fr/repas-nouveaux-newcomer-dinner"
className="w-full h-[600px] border-none mb-4"
/>
</div>
</div> */}
<div className="surface-card overflow-hidden">
<iframe
title="Billetterie Repas"
Expand Down
Loading