Skip to content

Commit

Permalink
Login complete
Browse files Browse the repository at this point in the history
  • Loading branch information
nabil-nablotech committed Dec 29, 2023
1 parent ce96aa3 commit 9b6e454
Show file tree
Hide file tree
Showing 44 changed files with 687 additions and 99 deletions.
32 changes: 32 additions & 0 deletions Backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"dependencies": {
"@nestjs/common": "^10.0.0",
"@nestjs/config": "^3.1.1",
"@nestjs/core": "^10.0.0",
"@nestjs/jwt": "^10.2.0",
"@nestjs/platform-express": "^10.0.0",
Expand Down
2 changes: 2 additions & 0 deletions Backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

import { JwtModule } from '@nestjs/jwt';
import { ConfigModule } from '@nestjs/config';
import { Module } from '@nestjs/common';
import { MachineLearningController } from './app/machineLearning/machineLearning.controller';
import { FrontendController } from './app/frontend/frontend.controller';
Expand All @@ -14,6 +15,7 @@ import { LoginService } from './login/login.service';

@Module({
imports: [
ConfigModule.forRoot(),
JwtModule.register({
global: true,
secret: process.env.JWT_SECRET,
Expand Down
12 changes: 6 additions & 6 deletions Backend/src/database/database.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export class DatabaseService {
if (size == 0) {
this.DB.collection(`users`).insertOne({
name: process.env.CSD_USER,
password: bcrypt.hashSync(
process.env.CSD_PASSWORD,
password: process.env.CSD_PASSWORD/* bcrypt.hashSync(
,
process.env.BCRYPT_SALT,
),
) */,
});
}
});
Expand All @@ -50,10 +50,10 @@ export class DatabaseService {
},
{
$set: {
password: bcrypt.hashSync(
process.env.CSD_PASSWORD,
password: process.env.CSD_PASSWORD/* bcrypt.hashSync(
,
process.env.BCRYPT_SALT,
),
) */,
},
},
);
Expand Down
2 changes: 1 addition & 1 deletion Backend/src/login/login.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class LoginService {
// console.log(bcrypt.hashSync(user.password, process.env.BCRYPT_SALT));
const encryptedUser = {
name: user.name,
password: bcrypt.hashSync(user.password, process.env.BCRYPT_SALT),
password: user.password/* bcrypt.hashSync(, process.env.BCRYPT_SALT) */,
};

// this should not throw an error, then the return is executed
Expand Down
1 change: 1 addition & 0 deletions Backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function bootstrap() {
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('swagger-api', app, document);

app.enableCors({ origin: true });
await app.listen(8080);

console.log(
Expand Down
1 change: 1 addition & 0 deletions Frontend/.env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_BACKEND_URL=http://localhost:8080/
Loading

0 comments on commit 9b6e454

Please sign in to comment.