Método de encryption primer paso

This commit is contained in:
Traym17 2022-07-10 21:42:06 -06:00
parent c2595d919d
commit b36003fb30
3 changed files with 777 additions and 4 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,9 @@
"@nestjs/mongoose": "^9.1.1",
"@nestjs/platform-express": "^8.0.0",
"@nestjs/swagger": "^5.2.1",
"buffer": "^5.7.1",
"crypto-browserify": "^3.12.0",
"md5-typescript": "^1.0.5",
"mongoose": "^6.4.1",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",

View File

@ -2,13 +2,14 @@ import { Injectable } from '@nestjs/common';
import { Model } from 'mongoose';
import { User, UserDocument } from '../schemas/user.schema';
import { InjectModel } from '@nestjs/mongoose';
import {Md5} from "md5-typescript";
@Injectable()
export class UsersService {
constructor(
@InjectModel(User.name) private readonly userModel: Model<UserDocument>,
) {}
private publicKey: string;
async create(user: UserDocument): Promise<User> {
return this.userModel.create(user);
}
@ -53,7 +54,8 @@ export class UsersService {
reject(err);
}
else {
if (res[0].password==password) {
let passwordEncriptada=Md5.init('1234');
if (res[0].password==passwordEncriptada) {
resolve(res[0]);
}
else {