@@ -182,6 +182,7 @@ export class PasswdService extends AbstractService {
182182 return false ;
183183 }
184184 }
185+
185186 //Changement du password
186187 public async change ( passwdDto : ChangePasswordDto ) : Promise < [ Jobs , any ] > {
187188 try {
@@ -273,6 +274,7 @@ export class PasswdService extends AbstractService {
273274 throw new BadRequestException ( 'Impossible de générer un token, une erreur est survenue' ) ;
274275 }
275276 }
277+
276278 // decrypte le token à l aide du code
277279 public async decryptTokenWithCode ( token : string , code : number ) : Promise < CipherData > {
278280 try {
@@ -295,6 +297,7 @@ export class PasswdService extends AbstractService {
295297 throw new BadRequestException ( 'Invalid token xx' ) ;
296298 }
297299 }
300+
298301 // decrypte le token d'initialisation du compte
299302 public async decryptToken ( token : string ) : Promise < CipherData > {
300303 try {
@@ -316,6 +319,7 @@ export class PasswdService extends AbstractService {
316319 throw new BadRequestException ( 'Invalid token' ) ;
317320 }
318321 }
322+
319323 // reset du password
320324 public async resetByCode ( data : ResetByCodeDto ) : Promise < [ Jobs , any ] > {
321325 this . logger . log ( 'resetByCode : ' + data . token + ' ' + data . code ) ;
@@ -357,6 +361,7 @@ export class PasswdService extends AbstractService {
357361 ) ;
358362 }
359363 }
364+
360365 // methode pour le reset par token (pour l initialisation du compte)
361366 public async reset ( data : ResetPasswordDto ) : Promise < [ Jobs , any ] > {
362367 const tokenData = await this . decryptToken ( data . token ) ;
@@ -393,6 +398,7 @@ export class PasswdService extends AbstractService {
393398 ) ;
394399 }
395400 }
401+
396402 //Envoi le message d init à plusieurs identités
397403 public async initMany ( ids : InitManyDto ) : Promise < any > {
398404 const identities = await this . identities . find ( { _id : { $in : ids . ids } , state : IdentityState . SYNCED } ) ;
@@ -407,6 +413,7 @@ export class PasswdService extends AbstractService {
407413 ) ;
408414 return updated as any ;
409415 }
416+
410417 // genere des octect pour completer le code qui est de 4 octets et demi
411418 private async getPaddingForCode ( ) : Promise < string > {
412419 let code = '' ;
@@ -418,6 +425,7 @@ export class PasswdService extends AbstractService {
418425 }
419426 return code ;
420427 }
428+
421429 private async setInitState ( identity : Identities , state : InitStatesEnum ) : Promise < any > {
422430 identity . initState = state ;
423431 if ( state === InitStatesEnum . SENT ) {
@@ -429,6 +437,7 @@ export class PasswdService extends AbstractService {
429437 const ok = await identity . save ( ) ;
430438 return ok ;
431439 }
440+
432441 // sort les identites qui n ont pas repondu dans le delai à l init de leurs comptes
433442 public async checkInitOutDated ( ) : Promise < any > {
434443 const date = new Date ( ) ;
0 commit comments