Skip to content

Commit 66916e5

Browse files
author
*rkeita31*
committed
formu okk
1 parent 181e72e commit 66916e5

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@angular/router": "^14.2.0",
3232
"ajv": "8.11.0",
3333
"arrive": "2.4.1",
34+
"bcryptjs": "^2.4.3",
3435
"bootstrap": "4.6.1",
3536
"bootstrap-material-design": "4.1.3",
3637
"bootstrap-notify": "3.1.3",
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Component, OnInit } from '@angular/core';
2+
import { FormGroup } from '@angular/forms';
23
import { Router } from '@angular/router';
34
import { Utilisateur } from 'app/model/utilisateur';
45
import { UtilisateurService } from 'app/services/utilisateur.service';
6+
import * as bcrypt from 'bcryptjs'
57

68

79
@Component({
@@ -10,24 +12,30 @@ import { UtilisateurService } from 'app/services/utilisateur.service';
1012
styleUrls: ['./registration.component.scss']
1113
})
1214
export class RegistrationComponent implements OnInit {
13-
user!:any[];
1415

1516
utilisateur: Utilisateur = new Utilisateur();
17+
myForm: FormGroup;
1618
constructor(private utilisateurService: UtilisateurService, private router: Router) { }
1719
ngOnInit(): void {
1820
this.saveUtilisateur();
21+
1922
$('[name="btn1"]').click(function(){
2023
alert("Compte créé avec succés");
2124
})
2225

26+
2327
}
2428

2529
saveUtilisateur() {
26-
this.utilisateurService.save(this.user).subscribe(
30+
this.utilisateurService.save(this.utilisateur).subscribe(
2731
() => {
2832
this.utilisateur = new Utilisateur();
2933
}
3034
)
3135
}
32-
}
36+
onSubmit() {
37+
const password = this.myForm.get('password').value;
38+
const hashedPassword = bcrypt.hashSync(password, 10);
3339

40+
}
41+
}

0 commit comments

Comments
 (0)