continuation de la partie admin

This commit is contained in:
MiharyR 2021-11-13 20:44:12 +01:00
parent de939b47f1
commit 91171a3765
35 changed files with 840 additions and 162 deletions

View file

@ -43,6 +43,7 @@ export class PopupUpdateUserComponent implements OnInit
isAccepted: user0.isAccepted,
createdAt: user0.createdAt,
updatedAt: user0.updatedAt,
lastConnexion: new Date()
};
for(let interest of user0.interests) this.userCopy.interests.push(interest);
}
@ -53,10 +54,8 @@ export class PopupUpdateUserComponent implements OnInit
this.checkField();
if(!this.hasError)
{
const data = {
user: this.userCopy,
newPassword: this.newPassword
};
if(this.changePassword) this.userCopy.hashPass = this.hashage(this.newPassword);
const data = { user: this.userCopy };
// VRAI CODE: envoie au back ...
@ -107,4 +106,17 @@ export class PopupUpdateUserComponent implements OnInit
this.userCopy.interests = myInterets;
}
// Fonction de hashage (faible)
hashage(input: string): string
{
let hash = 0;
for (let i = 0; i < input.length; i++) {
let ch = input.charCodeAt(i);
hash = ((hash << 5) - hash) + ch;
hash = hash & hash;
}
return hash.toString();
}
}