diff --git a/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.html b/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.html index 3e020de..d5d233a 100644 --- a/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.html +++ b/src/app/admin/adList/page-ad-list-admin/page-ad-list-admin.component.html @@ -87,7 +87,7 @@ - Annonceur + Entreprise {{advert.company}} diff --git a/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.html b/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.html index 6877336..7e025c5 100644 --- a/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.html +++ b/src/app/admin/myProfil/page-profil-admin/page-profil-admin.component.html @@ -15,7 +15,7 @@
-
Login:
+
Pseudo:
{{admin.login}}
diff --git a/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.ts b/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.ts index 5e61893..6f9eabc 100644 --- a/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.ts +++ b/src/app/admin/myProfil/popup-update-admin/popup-update-admin.component.ts @@ -68,7 +68,7 @@ export class PopupUpdateAdminComponent implements OnInit checkField() { if(this.adminCopy.login.length === 0) { - this.errorMessage = "Veuillez remplir le champ 'login'" ; + this.errorMessage = "Veuillez remplir le champ 'pseudo'" ; this.hasError = true; } else if(this.adminCopy.email.length === 0) { @@ -113,4 +113,5 @@ export class PopupUpdateAdminComponent implements OnInit } return hash.toString(); } + } diff --git a/src/app/admin/userList/page-user-list/page-user-list.component.html b/src/app/admin/userList/page-user-list/page-user-list.component.html index 421cb79..212f895 100644 --- a/src/app/admin/userList/page-user-list/page-user-list.component.html +++ b/src/app/admin/userList/page-user-list/page-user-list.component.html @@ -35,7 +35,7 @@ Utilisateur
- + Annonceur
@@ -99,7 +99,7 @@ - Login + Pseudo {{user.login}} diff --git a/src/app/admin/userList/popup-create-user/popup-create-user.component.html b/src/app/admin/userList/popup-create-user/popup-create-user.component.html index 6b8659d..2085ccd 100644 --- a/src/app/admin/userList/popup-create-user/popup-create-user.component.html +++ b/src/app/admin/userList/popup-create-user/popup-create-user.component.html @@ -58,7 +58,7 @@ - Login + Pseudo
@@ -130,7 +130,7 @@
- Login + Pseudo
diff --git a/src/app/admin/userList/popup-create-user/popup-create-user.component.ts b/src/app/admin/userList/popup-create-user/popup-create-user.component.ts index 5e0470c..141fe53 100644 --- a/src/app/admin/userList/popup-create-user/popup-create-user.component.ts +++ b/src/app/admin/userList/popup-create-user/popup-create-user.component.ts @@ -66,7 +66,7 @@ export class PopupCreateUserComponent implements OnInit checkField(): void { if(this.user.login.length === 0) { - this.errorMessage = "Veuillez remplir le champ 'login'."; + this.errorMessage = "Veuillez remplir le champ 'pseudo'."; this.hasError = true; } else if(this.user.email.length === 0) { diff --git a/src/app/admin/utils/components/navbar-admin/navbar-admin.component.html b/src/app/admin/utils/navbar-admin/navbar-admin.component.html similarity index 92% rename from src/app/admin/utils/components/navbar-admin/navbar-admin.component.html rename to src/app/admin/utils/navbar-admin/navbar-admin.component.html index 6bde92b..90f0cbc 100644 --- a/src/app/admin/utils/components/navbar-admin/navbar-admin.component.html +++ b/src/app/admin/utils/navbar-admin/navbar-admin.component.html @@ -15,8 +15,8 @@ Liste des utillisateurs diff --git a/src/app/admin/utils/components/navbar-admin/navbar-admin.component.scss b/src/app/admin/utils/navbar-admin/navbar-admin.component.scss similarity index 100% rename from src/app/admin/utils/components/navbar-admin/navbar-admin.component.scss rename to src/app/admin/utils/navbar-admin/navbar-admin.component.scss diff --git a/src/app/admin/utils/components/navbar-admin/navbar-admin.component.spec.ts b/src/app/admin/utils/navbar-admin/navbar-admin.component.spec.ts similarity index 100% rename from src/app/admin/utils/components/navbar-admin/navbar-admin.component.spec.ts rename to src/app/admin/utils/navbar-admin/navbar-admin.component.spec.ts diff --git a/src/app/admin/utils/components/navbar-admin/navbar-admin.component.ts b/src/app/admin/utils/navbar-admin/navbar-admin.component.ts similarity index 100% rename from src/app/admin/utils/components/navbar-admin/navbar-admin.component.ts rename to src/app/admin/utils/navbar-admin/navbar-admin.component.ts diff --git a/src/app/advertiser/myProfil/popup-update-advertiser/popup-update-advertiser.component.ts b/src/app/advertiser/myProfil/popup-update-advertiser/popup-update-advertiser.component.ts index 26882ac..23827fe 100644 --- a/src/app/advertiser/myProfil/popup-update-advertiser/popup-update-advertiser.component.ts +++ b/src/app/advertiser/myProfil/popup-update-advertiser/popup-update-advertiser.component.ts @@ -68,7 +68,7 @@ export class PopupUpdateAdvertiserComponent implements OnInit checkField() { if(this.advertiserCopy.login.length === 0) { - this.errorMessage = "Veuillez remplir le champ 'login'" ; + this.errorMessage = "Veuillez remplir le champ 'pseudo'" ; this.hasError = true; } else if(this.advertiserCopy.email.length === 0) { diff --git a/src/app/utils/directives/dragAndDrop/drag-and-drop.directive.spec.ts b/src/app/advertiser/utils/dragAndDrop/drag-and-drop.directive.spec.ts similarity index 100% rename from src/app/utils/directives/dragAndDrop/drag-and-drop.directive.spec.ts rename to src/app/advertiser/utils/dragAndDrop/drag-and-drop.directive.spec.ts diff --git a/src/app/utils/directives/dragAndDrop/drag-and-drop.directive.ts b/src/app/advertiser/utils/dragAndDrop/drag-and-drop.directive.ts similarity index 100% rename from src/app/utils/directives/dragAndDrop/drag-and-drop.directive.ts rename to src/app/advertiser/utils/dragAndDrop/drag-and-drop.directive.ts diff --git a/src/app/advertiser/utils/components/navbar-advertiser/navbar-advertiser.component.html b/src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.html similarity index 100% rename from src/app/advertiser/utils/components/navbar-advertiser/navbar-advertiser.component.html rename to src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.html diff --git a/src/app/advertiser/utils/components/navbar-advertiser/navbar-advertiser.component.scss b/src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.scss similarity index 100% rename from src/app/advertiser/utils/components/navbar-advertiser/navbar-advertiser.component.scss rename to src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.scss diff --git a/src/app/advertiser/utils/components/navbar-advertiser/navbar-advertiser.component.spec.ts b/src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.spec.ts similarity index 100% rename from src/app/advertiser/utils/components/navbar-advertiser/navbar-advertiser.component.spec.ts rename to src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.spec.ts diff --git a/src/app/advertiser/utils/components/navbar-advertiser/navbar-advertiser.component.ts b/src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.ts similarity index 100% rename from src/app/advertiser/utils/components/navbar-advertiser/navbar-advertiser.component.ts rename to src/app/advertiser/utils/navbar-advertiser/navbar-advertiser.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index d1b563b..28aa609 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -22,7 +22,6 @@ import {MatDividerModule} from "@angular/material/divider"; import {MatCheckboxModule} from "@angular/material/checkbox"; import {MatFormFieldModule} from "@angular/material/form-field"; import {MatSnackBarModule} from "@angular/material/snack-bar"; -import { IframeTrackerDirective } from './utils/directives/iframe-tracker/iframe-tracker.directive'; import {MatGridListModule} from "@angular/material/grid-list"; import { PageMyPlaylistsComponent } from './user/myPlaylists/page-my-playlists/page-my-playlists.component'; import { PlaylistListComponent } from './user/myPlaylists/playlist-list/playlist-list.component'; @@ -43,15 +42,15 @@ import {MatSelectModule} from "@angular/material/select"; import { PopupVisualizeImagesAdvertiserComponent } from './advertiser/adList/popup-visualize-images-advertiser/popup-visualize-images-advertiser.component'; import {IvyCarouselModule} from "angular-responsive-carousel"; import { DragAndDropComponent } from './advertiser/adList/drag-and-drop/drag-and-drop.component'; -import { DragAndDropDirective } from './utils/directives/dragAndDrop/drag-and-drop.directive'; +import { DragAndDropDirective } from './advertiser/utils/dragAndDrop/drag-and-drop.directive'; import { PageProfilUserComponent } from './user/myProfil/page-profil-user/page-profil-user.component'; import { NavbarUserComponent } from './user/utils/components/navbar-user/navbar-user.component'; -import { NavbarAdvertiserComponent } from './advertiser/utils/components/navbar-advertiser/navbar-advertiser.component'; -import { NavbarAdminComponent } from './admin/utils/components/navbar-admin/navbar-admin.component'; +import { NavbarAdvertiserComponent } from './advertiser/utils/navbar-advertiser/navbar-advertiser.component'; +import { NavbarAdminComponent } from './admin/utils/navbar-admin/navbar-admin.component'; import { PageProfilAdvertiserComponent } from './advertiser/myProfil/page-profil-advertiser/page-profil-advertiser.component'; import { PopupUpdateAdvertiserComponent } from './advertiser/myProfil/popup-update-advertiser/popup-update-advertiser.component'; import { PopupUpdateUserComponent } from './user/myProfil/popup-update-user/popup-update-user.component'; -import { NavbarBeforeConnexionComponent } from './beforeConnexion/navbar-before-connexion/navbar-before-connexion.component'; +import { NavbarBeforeConnexionComponent } from './beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component'; import {MatRadioModule} from "@angular/material/radio"; import { InputInterestsProfilComponent } from './user/myProfil/input-interests-profil/input-interests-profil.component'; import { PageProfilAdminComponent } from './admin/myProfil/page-profil-admin/page-profil-admin.component'; @@ -85,7 +84,6 @@ import { PopupDeletePlaylistComponent } from './user/myPlaylists/popup-delete-pl AdvertComponent, VideoGridComponent, PopupAddVideoToPlaylistsComponent, - IframeTrackerDirective, PageMyPlaylistsComponent, VideoListComponent, PlaylistListComponent, diff --git a/src/app/beforeConnexion/login/page-login/page-login.component.html b/src/app/beforeConnexion/login/page-login/page-login.component.html index 1404ee9..48258aa 100644 --- a/src/app/beforeConnexion/login/page-login/page-login.component.html +++ b/src/app/beforeConnexion/login/page-login/page-login.component.html @@ -14,8 +14,8 @@
- - + +
{{errorMessage}} diff --git a/src/app/beforeConnexion/login/page-login/page-login.component.ts b/src/app/beforeConnexion/login/page-login/page-login.component.ts index 68130da..008a81f 100644 --- a/src/app/beforeConnexion/login/page-login/page-login.component.ts +++ b/src/app/beforeConnexion/login/page-login/page-login.component.ts @@ -12,7 +12,7 @@ import {ThemeService} from "../../../utils/services/theme/theme.service"; }) export class PageLoginComponent implements OnInit { - pseudo: string = "" ; + email: string = "" ; password: string = "" ; hasError: boolean = false; errorMessage: string = ""; @@ -33,8 +33,8 @@ export class PageLoginComponent implements OnInit if(!this.hasError) { let data = { - login: this.pseudo, - hashPass: this.password + email: this.email, + hashPass: this.hashage(this.password) }; this.messageService .sendMessage('user/auth', data) @@ -58,8 +58,8 @@ export class PageLoginComponent implements OnInit checkError(): void { - if(this.pseudo === "") { - this.errorMessage = "Veuillez remplir le champ login" ; + if(this.email === "") { + this.errorMessage = "Veuillez remplir le champ email" ; this.hasError = true; } else if(this.password === "") { @@ -72,4 +72,16 @@ export class PageLoginComponent implements OnInit } } + // 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(); + } + } diff --git a/src/app/beforeConnexion/register/page-register/page-register.component.html b/src/app/beforeConnexion/register/page-register/page-register.component.html index c3dafab..42ad1a5 100644 --- a/src/app/beforeConnexion/register/page-register/page-register.component.html +++ b/src/app/beforeConnexion/register/page-register/page-register.component.html @@ -63,7 +63,7 @@ - Login + Pseudo
diff --git a/src/app/beforeConnexion/register/page-register/page-register.component.ts b/src/app/beforeConnexion/register/page-register/page-register.component.ts index db9d8cf..c109478 100644 --- a/src/app/beforeConnexion/register/page-register/page-register.component.ts +++ b/src/app/beforeConnexion/register/page-register/page-register.component.ts @@ -100,7 +100,7 @@ export class PageRegisterComponent this.hasError = true; } else if(this.user.login.length === 0) { - this.errorMessage = "Veuillez remplir le champ 'login'."; + this.errorMessage = "Veuillez remplir le champ 'pseudo'."; this.hasError = true; } else if(this.user.email.length === 0) { diff --git a/src/app/beforeConnexion/navbar-before-connexion/navbar-before-connexion.component.html b/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.html similarity index 100% rename from src/app/beforeConnexion/navbar-before-connexion/navbar-before-connexion.component.html rename to src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.html diff --git a/src/app/beforeConnexion/navbar-before-connexion/navbar-before-connexion.component.scss b/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.scss similarity index 100% rename from src/app/beforeConnexion/navbar-before-connexion/navbar-before-connexion.component.scss rename to src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.scss diff --git a/src/app/beforeConnexion/navbar-before-connexion/navbar-before-connexion.component.spec.ts b/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.spec.ts similarity index 100% rename from src/app/beforeConnexion/navbar-before-connexion/navbar-before-connexion.component.spec.ts rename to src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.spec.ts diff --git a/src/app/beforeConnexion/navbar-before-connexion/navbar-before-connexion.component.ts b/src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.ts similarity index 100% rename from src/app/beforeConnexion/navbar-before-connexion/navbar-before-connexion.component.ts rename to src/app/beforeConnexion/utils/navbar-before-connexion/navbar-before-connexion.component.ts diff --git a/src/app/user/history/page-history-user/page-history-user.component.html b/src/app/user/history/page-history-user/page-history-user.component.html index 07ef9dd..d14ad31 100644 --- a/src/app/user/history/page-history-user/page-history-user.component.html +++ b/src/app/user/history/page-history-user/page-history-user.component.html @@ -33,9 +33,9 @@ - Date + Date - {{video.watchedDates[video.watchedDates.length-1] | date:'dd/LL/YYYY à HH:mm:ss'}} + {{video.date | date:'dd/LL/YYYY à HH:mm:ss'}} diff --git a/src/app/user/history/page-history-user/page-history-user.component.ts b/src/app/user/history/page-history-user/page-history-user.component.ts index 5f1ff69..6999167 100644 --- a/src/app/user/history/page-history-user/page-history-user.component.ts +++ b/src/app/user/history/page-history-user/page-history-user.component.ts @@ -11,6 +11,15 @@ import {Router} from "@angular/router"; +interface VideoHistory { + imageUrl: string, + title: string, + date: Date, + source: string, +} + + + @Component({ selector: 'app-page-history-user', templateUrl: './page-history-user.component.html', @@ -37,8 +46,10 @@ export class PageHistoryUserComponent implements AfterViewInit this.userHistoryService.clearTabVideoUrlClicked(); // --- FAUX CODE --- - const tabVideo: VideoAll[] = this.fictitiousVideosService.getTabVideoAll(8); - this.dataSource = new MatTableDataSource(tabVideo); + const tabVideoAll: VideoAll[] = this.fictitiousVideosService.getTabVideoAll(8); + let tabVideoHistory: VideoHistory[] = []; + for(let videoAll of tabVideoAll) tabVideoHistory.push(this.videoAllToVideoHistory(videoAll)); + this.dataSource = new MatTableDataSource(tabVideoHistory); this.dataSource.sort = this.sort; this.dataSource.paginator = this.paginator; this.dataSource = this.dataSource; @@ -67,15 +78,6 @@ export class PageHistoryUserComponent implements AfterViewInit } - // Retourne la source de la video en fonction de l'url - getSourceByUrl(url: string): string - { - if(url.includes("youtu")) return "Youtube" ; - else if(url.includes("daily")) return "Dailymotion" ; - else return "???" ; - } - - // Supprime la video onDelete(video: VideoAll): void { @@ -109,4 +111,15 @@ export class PageHistoryUserComponent implements AfterViewInit this.router.navigateByUrl(url); } + + videoAllToVideoHistory(videoAll: VideoAll): VideoHistory + { + return { + imageUrl: videoAll.imageUrl, + title: videoAll.title, + date: videoAll.watchedDates[videoAll.watchedDates.length-1], + source: videoAll.source, + } + } + } diff --git a/src/app/user/myProfil/page-profil-user/page-profil-user.component.html b/src/app/user/myProfil/page-profil-user/page-profil-user.component.html index fa22205..7e69ded 100644 --- a/src/app/user/myProfil/page-profil-user/page-profil-user.component.html +++ b/src/app/user/myProfil/page-profil-user/page-profil-user.component.html @@ -37,7 +37,7 @@
-
Login:
+
Pseudo:
{{user.login}}
diff --git a/src/app/user/myProfil/popup-update-user/popup-update-user.component.html b/src/app/user/myProfil/popup-update-user/popup-update-user.component.html index 6544c05..1e583c7 100644 --- a/src/app/user/myProfil/popup-update-user/popup-update-user.component.html +++ b/src/app/user/myProfil/popup-update-user/popup-update-user.component.html @@ -39,7 +39,7 @@
- +
diff --git a/src/app/user/myProfil/popup-update-user/popup-update-user.component.ts b/src/app/user/myProfil/popup-update-user/popup-update-user.component.ts index c6abfb7..806b6c9 100644 --- a/src/app/user/myProfil/popup-update-user/popup-update-user.component.ts +++ b/src/app/user/myProfil/popup-update-user/popup-update-user.component.ts @@ -68,7 +68,7 @@ export class PopupUpdateUserComponent implements OnInit checkField() { if(this.userCopy.login.length === 0) { - this.errorMessage = "Veuillez remplir le champ 'login'." ; + this.errorMessage = "Veuillez remplir le champ 'pseudo'." ; this.hasError = true; } else if(this.userCopy.email.length === 0) { diff --git a/src/app/utils/directives/iframe-tracker/iframe-tracker.directive.spec.ts b/src/app/utils/directives/iframe-tracker/iframe-tracker.directive.spec.ts deleted file mode 100644 index da22920..0000000 --- a/src/app/utils/directives/iframe-tracker/iframe-tracker.directive.spec.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { IframeTrackerDirective } from './iframe-tracker.directive'; - -describe('IframeTrackerDirective', () => { - it('should create an instance', () => { - const directive = new IframeTrackerDirective(); - expect(directive).toBeTruthy(); - }); -}); diff --git a/src/app/utils/directives/iframe-tracker/iframe-tracker.directive.ts b/src/app/utils/directives/iframe-tracker/iframe-tracker.directive.ts deleted file mode 100644 index c4c5957..0000000 --- a/src/app/utils/directives/iframe-tracker/iframe-tracker.directive.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { - Directive, - ElementRef, - OnInit, - Renderer2, - Input, - Output, - EventEmitter, - HostListener -} from '@angular/core'; - -@Directive({ - selector: '[appIframeTracker]' -}) -export class IframeTrackerDirective implements OnInit { - private iframeMouseOver: boolean; - - @Input() debug: boolean; - - @Output() iframeClick = new EventEmitter(); - - constructor(private el: ElementRef, private renderer: Renderer2) {} - - ngOnInit(): void { - this.renderer.listen(window, 'blur', () => this.onWindowBlur()); - } - - @HostListener('mouseover') - private onIframeMouseOver() { - this.log('Iframe mouse over'); - this.iframeMouseOver = true; - this.resetFocusOnWindow(); - } - - @HostListener('mouseout') - private onIframeMouseOut() { - this.log('Iframe mouse out'); - this.iframeMouseOver = false; - this.resetFocusOnWindow(); - } - - private onWindowBlur() { - if (this.iframeMouseOver) { - this.log('WOW! Iframe click!!!'); - this.resetFocusOnWindow(); - this.iframeClick.emit(this.el); - } - } - - private resetFocusOnWindow() { - setTimeout(() => { - this.log('reset focus to window'); - window.focus(); - }, 100); - } - - private log(message: string) { - if (this.debug) { - console.log(message); - } - } -}