security changes
This commit is contained in:
parent
06928fe245
commit
3cb3206ecc
5 changed files with 37 additions and 24 deletions
|
|
@ -24,6 +24,7 @@ psutil==6.0.0
|
||||||
psycopg2-binary==2.9.9
|
psycopg2-binary==2.9.9
|
||||||
pubcontrol==3.5.0
|
pubcontrol==3.5.0
|
||||||
PyJWT==2.9.0
|
PyJWT==2.9.0
|
||||||
|
python-decouple==3.8
|
||||||
redis==5.0.8
|
redis==5.0.8
|
||||||
requests==2.32.3
|
requests==2.32.3
|
||||||
rq==1.16.2
|
rq==1.16.2
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/5.0/ref/settings/
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from decouple import config
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
@ -30,8 +31,8 @@ DEBUG = True
|
||||||
EMAIL_USE_TLS = True
|
EMAIL_USE_TLS = True
|
||||||
EMAIL_HOST = 'smtp.gmail.com'
|
EMAIL_HOST = 'smtp.gmail.com'
|
||||||
EMAIL_PORT = 587
|
EMAIL_PORT = 587
|
||||||
EMAIL_HOST_USER = 'andre.kempf.dev@gmail.com'
|
EMAIL_HOST_USER = config('EMAIL_HOST_USER', default='')
|
||||||
EMAIL_HOST_PASSWORD = 'oyxwawshudwytgud'
|
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', default='')
|
||||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||||
DEFAULT_FROM_EMAIL = 'noreply@videoflix.com'
|
DEFAULT_FROM_EMAIL = 'noreply@videoflix.com'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,16 @@
|
||||||
# Frontend
|
# Backend
|
||||||
|
|
||||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.2.1.
|
To set the mail configuration for the backend, you must create an `.env` file in the root directory of your project. This file should have the following content:
|
||||||
|
|
||||||
## Development server
|
## Step 1: Creating the `.env` file
|
||||||
|
|
||||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
Create a file named `.env` in the root directory of the project.
|
||||||
|
|
||||||
## Code scaffolding
|
## Step 2: Add the e-mail configuration
|
||||||
|
|
||||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
Open the `.env` file and add the following lines:
|
||||||
|
|
||||||
## Build
|
```env
|
||||||
|
EMAIL_HOST_USER=example@gmail.com
|
||||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
EMAIL_HOST_PASSWORD=password
|
||||||
|
```
|
||||||
## Running unit tests
|
|
||||||
|
|
||||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
||||||
|
|
||||||
## Running end-to-end tests
|
|
||||||
|
|
||||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
|
||||||
|
|
||||||
## Further help
|
|
||||||
|
|
||||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,12 @@
|
||||||
name="videoFile"
|
name="videoFile"
|
||||||
placeholder="Video file"
|
placeholder="Video file"
|
||||||
(change)="onFileChange($event)"
|
(change)="onFileChange($event)"
|
||||||
|
accept="video/*"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<div class="error-msg"></div>
|
<div class="error-msg">
|
||||||
|
<p>{{ errorMsgFileSize }}</p>
|
||||||
|
</div>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<app-btn-large
|
<app-btn-large
|
||||||
[value]="'Close'"
|
[value]="'Close'"
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ import { LoadingDialogComponent } from '../../../../shared/components/loading-di
|
||||||
})
|
})
|
||||||
export class UploadMovieComponent {
|
export class UploadMovieComponent {
|
||||||
@Output() toggleUploadMovieOverview = new EventEmitter<boolean>();
|
@Output() toggleUploadMovieOverview = new EventEmitter<boolean>();
|
||||||
|
errorMsgFileSize: string | null = null;
|
||||||
|
maxFileSizeMB = 50;
|
||||||
|
|
||||||
movieData = {
|
movieData = {
|
||||||
title: '',
|
title: '',
|
||||||
|
|
@ -43,11 +45,28 @@ export class UploadMovieComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
onFileChange(event: any) {
|
onFileChange(event: any) {
|
||||||
|
this.isOneFile(event);
|
||||||
|
this.isFileSize(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
isOneFile(event: any) {
|
||||||
const file = event.target.files[0];
|
const file = event.target.files[0];
|
||||||
if (file) {
|
if (file) {
|
||||||
this.movieData.videoFile = file;
|
this.movieData.videoFile = file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isFileSize(event: any) {
|
||||||
|
const file = event.target.files[0];
|
||||||
|
if (file) {
|
||||||
|
const fileSizeMB = file.size / (1024 * 1024);
|
||||||
|
if (fileSizeMB > this.maxFileSizeMB) {
|
||||||
|
this.errorMsgFileSize = `The file must not be larger than ${this.maxFileSizeMB} MB.`;
|
||||||
|
event.target.value = '';
|
||||||
|
} else {
|
||||||
|
this.errorMsgFileSize = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async onSubmit(ngForm: NgForm) {
|
async onSubmit(ngForm: NgForm) {
|
||||||
if (!ngForm.submitted || !ngForm.form.valid) return;
|
if (!ngForm.submitted || !ngForm.form.valid) return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue