Skip to content

Commit dad2594

Browse files
committed
chore: Update filestorage configuration for identities module
1 parent b226852 commit dad2594

16 files changed

+48
-84
lines changed

src/management/passwd/_dto/ask-token.dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { IsString } from 'class-validator';
44
export class AskTokenDto {
55
@IsString()
66
@ApiProperty({ example: 'paul.bismuth', description: 'User id' })
7-
uid: string;
7+
public uid: string;
88

99
@ApiProperty({ example: 'monemail@mondomaine.com', description: 'secondary mail' })
1010
@IsString()
11-
mail: string;
11+
public mail: string;
1212
}

src/management/passwd/_dto/init-account.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import { IsString } from 'class-validator';
44
export class InitAccountDto {
55
@ApiProperty({ example: 'uid', description: 'paul.smith' })
66
@IsString()
7-
uid: string;
7+
public uid: string;
88
}

src/management/passwd/_dto/init-reset.dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { IsNumber, IsString } from 'class-validator';
44
export class InitResetDto {
55
@IsString()
66
@ApiProperty({ example: 'paul.bismuth', description: 'User id' })
7-
uid: string;
7+
public uid: string;
88

99
@IsNumber()
1010
@ApiProperty({ example: 0, description: '0 = send by mail, 1 = send by SMS' })
11-
type: number;
11+
public type: number;
1212
}

src/management/passwd/_dto/reset-by-code.dto.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import { IsNumber, IsString } from 'class-validator';
44
export class ResetByCodeDto {
55
@IsString()
66
@ApiProperty({ example: '3F4AC...', description: 'Token received by initreset' })
7-
token: string;
7+
public token: string;
88

99
@IsNumber()
1010
@ApiProperty({ example: '123456', description: 'Code received by email or Sms' })
11-
code: number;
11+
public code: number;
12+
1213
@IsString()
1314
@ApiProperty({ example: 'hdfddyf18A', description: 'new password' })
14-
newpassword: string;
15+
public newpassword: string;
1516
}

src/management/passwd/_dto/reset-password.dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ export class ResetPasswordDto {
77
example: 'S9nv9vjxdW7bS0haoWUmdJ3XPbSJ7dSdRj2ND1z9RvqLK/sF1LKZpfnWDvLX1dZuG0WGEyAb9A==',
88
description: 'Token',
99
})
10-
token: string;
10+
public token: string;
1111

1212
@ApiProperty({ example: 'MyNewPassword', description: 'New Password' })
1313
@IsString()
14-
newPassword: string;
14+
public newPassword: string;
1515
}

src/management/passwd/_dto/verify-token.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export class VerifyTokenDto {
77
description: 'token received by getToken',
88
})
99
@IsString()
10-
token: string;
10+
public token: string;
1111
}

src/management/passwd/passwd.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class PasswdController {
3131
public constructor(
3232
private passwdService: PasswdService,
3333
private passwdadmService: PasswdadmService,
34-
) {}
34+
) { }
3535

3636
@Post('change')
3737
@ApiOperation({ summary: 'Execute un job de changement de mot de passe sur le/les backends' })

src/management/passwd/passwd.module.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ import { PasswdService } from './passwd.service';
33
import { PasswdController } from './passwd.controller';
44
import { BackendsModule } from '~/core/backends/backends.module';
55
import { IdentitiesModule } from '../identities/identities.module';
6-
import { PasswdadmModule } from '~/settings/passwdadm/passwdadm.module';
7-
import { PasswdadmService } from '~/settings/passwdadm/passwdadm.service';
8-
import { SmsService } from '~/management/passwd/sms-service';
6+
import { SettingsModule } from '~/settings/settings.module';
97

108
@Module({
11-
imports: [BackendsModule, IdentitiesModule, PasswdadmModule],
9+
imports: [BackendsModule, IdentitiesModule, SettingsModule],
1210
controllers: [PasswdController],
13-
providers: [PasswdService, SmsService],
11+
providers: [PasswdService],
1412
})
15-
export class PasswdModule {}
13+
export class PasswdModule { }

src/management/passwd/passwd.service.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

src/settings/_dto/mail.settings.dto.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ import { ApiProperty } from '@nestjs/swagger';
44
export class MailSettingsDto {
55
@IsUrl({ protocols: ['smtp', 'smtps'], require_protocol: true })
66
@ApiProperty({ example: 'smtp://smscsim.smpp.org:25', description: 'Serveur SMTP', type: String })
7-
public host: string;
7+
public host: string = 'smtp://localhost:25';
8+
89
@IsEmail()
910
@ApiProperty({ example: 'no-reply@mondomaine', description: 'Emetteur', type: String })
1011
public sender: string;
12+
1113
@IsString()
1214
@ApiProperty({ example: 'monlogin@mondomaine', description: 'username', type: String })
1315
public username: string;
16+
1417
@IsString()
1518
@ApiProperty({ example: 'myPassword', description: 'password', type: String })
1619
public password: string;

0 commit comments

Comments
 (0)