|
1 | 1 | import bcrypt from 'bcryptjs'; |
2 | | -import bigInt from 'big-integer'; |
| 2 | +//import bigInt from 'big-integer'; |
3 | 3 | import { sign, verify } from 'jsonwebtoken'; |
4 | 4 | import type { EmailOptions } from '../types/email'; |
5 | 5 | import { templateResetPassword } from '../email/email.registry'; |
6 | 6 | import { compileTemplate } from '../email/email.renderer'; |
7 | 7 | import * as auth_service from '../services/auth.service'; |
8 | | -import * as banned_service from '../services/banned.service'; |
| 8 | +//import * as banned_service from '../services/banned.service'; |
9 | 9 | import * as email_service from '../services/email.service'; |
10 | 10 | import * as registration_service from '../services/registration.service'; |
11 | 11 | import * as role_service from '../services/role.service'; |
@@ -58,27 +58,28 @@ export const handlecasticket: AppRequestHandler<unknown, CasTicketQuery> = async |
58 | 58 | const CASuser = await auth_service.validateCASTicket(ticket); |
59 | 59 |
|
60 | 60 | if (CASuser && CASuser.email && CASuser.givenName && CASuser.sn) { |
61 | | - // Assurez-vous que user.email est un string |
62 | | - let user = await user_service.getUserByEmail(CASuser.email.toLowerCase()); |
63 | | - if (!user) { |
64 | | - const isBanned = await banned_service.getBannedByEmail(CASuser.email); |
65 | | - |
66 | | - if (isBanned) { |
67 | | - Unauthorized(res, { msg: 'Unauthorized: user email prohibited' }); |
68 | | - } |
69 | | - |
70 | | - const password = bigInt.randBetween(bigInt(2).pow(255), bigInt(2).pow(256).minus(1)).toString(); |
71 | | - await user_service.createUser( |
72 | | - CASuser.givenName, |
73 | | - CASuser.sn, |
74 | | - CASuser.email, |
75 | | - true, |
76 | | - 'Student', |
77 | | - ' ', |
78 | | - password, |
79 | | - ); |
80 | | - user = await user_service.getUserByEmail(CASuser.email.toLowerCase()); |
81 | | - } |
| 61 | + // TEMPORAIRE POUR BLOQUER LA CREATION DE COMPTES NOUVEAUX |
| 62 | + // remettre user en let |
| 63 | + const user = await user_service.getUserByEmail(CASuser.email.toLowerCase()); |
| 64 | + // if (!user) { |
| 65 | + // const isBanned = await banned_service.getBannedByEmail(CASuser.email); |
| 66 | + // |
| 67 | + // if (isBanned) { |
| 68 | + // Unauthorized(res, { msg: 'Unauthorized: user email prohibited' }); |
| 69 | + // } |
| 70 | + // |
| 71 | + // const password = bigInt.randBetween(bigInt(2).pow(255), bigInt(2).pow(256).minus(1)).toString(); |
| 72 | + // await user_service.createUser( |
| 73 | + // CASuser.givenName, |
| 74 | + // CASuser.sn, |
| 75 | + // CASuser.email, |
| 76 | + // true, |
| 77 | + // 'Student', |
| 78 | + // ' ', |
| 79 | + // password, |
| 80 | + // ); |
| 81 | + // user = await user_service.getUserByEmail(CASuser.email.toLowerCase()); |
| 82 | + // } |
82 | 83 |
|
83 | 84 | const id = user?.id; |
84 | 85 |
|
|
0 commit comments