formation 3 anos atrás
pai
commit
a6b7c834d4

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
angular-client/dist/fatboar/index.html


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
angular-client/dist/fatboar/main-es2015.7b6b4bcd54eabd1b9cfb.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
angular-client/dist/fatboar/main-es5.7b6b4bcd54eabd1b9cfb.js


+ 3 - 3
angular-client/src/app/components/login/login.component.ts

@@ -72,20 +72,20 @@ export class LoginComponent implements OnInit {
     this.loading = true;
     this.authService.signIn(this.formGroup.value).subscribe(
       data => {
-          // this.router.navigate([this.returnUrl]);
+          
           console.log(data)
           this.loading = false;
           this.router.navigate(['/auth']);
           setTimeout(() => {
             document.location.reload()
-          },1000)
+          },2000)
       },
       err => {
           this.loading = false;
           console.log(err.error.message)
           this.authService.openSnackBar(err.error.message)
       });
-    // this.router.navigate(['/']);
+    
     
   }
 

+ 117 - 118
angular-client/src/app/components/register/register.component.html

@@ -1,133 +1,132 @@
 <div class="container navtop">
 
 
-    <div class="row justify-content-center">
-      <mat-card class="col-11 col-lg-7">
-        <mat-card-content>
-          <form [formGroup]="formGroup" (ngSubmit)="signUp()">
-            <mat-progress-bar class="row " *ngIf="loading" mode="indeterminate"></mat-progress-bar>
-            <div class="row justify-content-center ">
-              <button (click)="signGoogle()" mat-raised-button class="col-10 col-lg-5 mr-lg-2 mb-2 googlelogin" style="background-color: #DB4437; color: white;">
-                <div class="row mt-1 ml-3">
-                  <mat-icon class="ml-2" svgIcon="googleLogo"></mat-icon>
-                  <p class="ml-2 marginButton">Se connecter avec Google</p>
-                </div>
-              </button>
-            <h1 class="row justify-content-center"><b>Inscription</b></h1>
-  
-           
-            
-              <button mat-raised-button class="col-10 col-lg-5 ml-lg-2 mb-2 facebooklogin" style="background-color: #3b5998; color: white;">
-                <div class="row mt-1 ml-3">
-                  <mat-icon class="ml-2" svgIcon="facebookLogo"></mat-icon>
-                  <p class="ml-2 marginButton">Se connecter avec Facebook</p>
-                </div>
-              </button>
-            </div>
-  
-            <div class="row  justify-content-center">
-              <div class="col-4">
-                <hr>
-              </div>
-              <div class="col-1">
-                <p>ou</p>
+  <div class="row justify-content-center">
+    <mat-card class="col-11 col-lg-7">
+      <mat-card-content>
+        <form [formGroup]="formGroup" (ngSubmit)="signUp()">
+          <mat-progress-bar class="row " *ngIf="loading" mode="indeterminate"></mat-progress-bar>
+          <h1 class="row justify-content-center"><b>Inscription</b></h1>
+
+          <div class="row justify-content-center ">
+            <button mat-raised-button class="col-10 col-lg-5 mr-lg-2 mb-2 googlelogin" style="background-color: #DB4437; color: white;">
+              <div class="row mt-1 ml-3">
+                <mat-icon class="ml-2" svgIcon="googleLogo"></mat-icon>
+                <p class="ml-2 marginButton">Se connecter avec Google</p>
               </div>
-              <div class="col-4">
-                <hr>
+            </button>
+          
+            <button mat-raised-button class="col-10 col-lg-5 ml-lg-2 mb-2 facebooklogin" style="background-color: #3b5998; color: white;">
+              <div class="row mt-1 ml-3">
+                <mat-icon class="ml-2" svgIcon="facebookLogo"></mat-icon>
+                <p class="ml-2 marginButton">Se connecter avec Facebook</p>
               </div>
-            </div>
-            <div class="row justify-content-center">
-              <mat-form-field class="col-5">
-                <input matInput placeholder="Nom :" formControlName="lastname" required>
-                <mat-error *ngIf="!formGroup.controls['lastname'].valid || formGroup.controls['lastname'].touched">
-                  {{ getErrorLastname() }}
-                </mat-error>
-              </mat-form-field>
-              <mat-form-field class="col-5">
-                <input matInput placeholder="Prénom :" formControlName="firstname" required>
-                <mat-error *ngIf="!formGroup.controls['firstname'].valid || formGroup.controls['firstname'].touched">
-                  {{ getErrorFirstname() }}
-                </mat-error>
-              </mat-form-field>
-            </div>
+            </button>
+          </div>
 
-            <div class="row justify-content-center">
-              <mat-form-field class="col-10">
-                <input matInput placeholder="Numéro de téléphone :" formControlName="phonenumber" required>
-                <mat-error *ngIf="!formGroup.controls['phonenumber'].valid || formGroup.controls['phonenumber'].touched">
-                  {{ getErrorPhonenumber() }}
-                </mat-error>
-              </mat-form-field>
-            </div>
-            <div class="row justify-content-center">
-              <mat-form-field  class="col-10">
-                <mat-label>Date de naissance :</mat-label>
-                <input matInput [matDatepicker]="picker" disabled="true" [max]="maxDate" formControlName="birthday" (click)="picker.open()"  required>
-                <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
-                <mat-datepicker touchUi disabled="false"  #picker></mat-datepicker>
-                <mat-error *ngIf="!formGroup.controls['birthday'].valid || formGroup.controls['birthday'].touched">
-                  {{ getErrorDate() }}
-                </mat-error>
-              </mat-form-field>
-            </div>
-            <div class="row justify-content-center">
-              <mat-form-field class="col-10">
-                <input matInput placeholder="Adresse :" formControlName="adress" required>
-                <mat-error *ngIf="!formGroup.controls['adress'].valid || formGroup.controls['adress'].touched">
-                  {{ getErrorAdress() }}
-                </mat-error>
-              </mat-form-field>
+          <div class="row  justify-content-center">
+            <div class="col-4">
+              <hr>
             </div>
-  
-            <div class="row justify-content-center">
-              <mat-form-field class="col-10">
-                <input matInput placeholder="Adresse email :" formControlName="email" required>
-                <mat-error *ngIf="!formGroup.controls['email'].valid || formGroup.controls['email'].touched">
-                  {{ getErrorEmail() }}
-                </mat-error>
-              </mat-form-field>
+            <div class="col-1">
+              <p>ou</p>
             </div>
-            <div class="row justify-content-center">
-              <mat-form-field class="col-10">
-                <input matInput placeholder="Mot de passe :" formControlName="password" [type]="hide ? 
-                'password' : 'text'" required>
-                <mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 
-                  'visibility'}}</mat-icon>
-                <mat-error *ngIf="!formGroup.controls['password'].valid || formGroup.controls['password'].touched">
-                  {{ getErrorPassword() }}
-                </mat-error>
-              </mat-form-field>
+            <div class="col-4">
+              <hr>
             </div>
-            <div class="row justify-content-center">
-              <mat-form-field class="col-10">
-                <input matInput placeholder="Confirmer le mot de passe :" formControlName="confirmPassword"  [type]="hide ? 
-                'password' : 'text'" required>
-                <mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 
-                  'visibility'}}</mat-icon>
-                  <mat-error *ngIf="!formGroup.controls['password'].valid || formGroup.controls['password'].touched">
-                  {{ getErrorConfirmPassword() }}
+          </div>
+          <div class="row justify-content-center">
+            <mat-form-field class="col-5">
+              <input matInput placeholder="Nom :" formControlName="lastname" required>
+              <mat-error *ngIf="!formGroup.controls['lastname'].valid || formGroup.controls['lastname'].touched">
+                {{ getErrorLastname() }}
               </mat-error>
-              </mat-form-field>
-            </div>
+            </mat-form-field>
+            <mat-form-field class="col-5">
+              <input matInput placeholder="Prénom :" formControlName="firstname" required>
+              <mat-error *ngIf="!formGroup.controls['firstname'].valid || formGroup.controls['firstname'].touched">
+                {{ getErrorFirstname() }}
+              </mat-error>
+            </mat-form-field>
+          </div>
+
+          <div class="row justify-content-center">
+            <mat-form-field class="col-10">
+              <input matInput placeholder="Numéro de téléphone :" formControlName="phonenumber" required>
+              <mat-error *ngIf="!formGroup.controls['phonenumber'].valid || formGroup.controls['phonenumber'].touched">
+                {{ getErrorPhonenumber() }}
+              </mat-error>
+            </mat-form-field>
+          </div>
+          <div class="row justify-content-center">
+            <mat-form-field  class="col-10">
+              <mat-label>Date de naissance :</mat-label>
+              <input matInput [matDatepicker]="picker" disabled="true" [max]="maxDate" formControlName="birthday" (click)="picker.open()"  required>
+              <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
+              <mat-datepicker touchUi disabled="false"  #picker></mat-datepicker>
+              <mat-error *ngIf="!formGroup.controls['birthday'].valid || formGroup.controls['birthday'].touched">
+                {{ getErrorDate() }}
+              </mat-error>
+            </mat-form-field>
+          </div>
+          <div class="row justify-content-center">
+            <mat-form-field class="col-10">
+              <input matInput placeholder="Adresse :" formControlName="adress" required>
+              <mat-error *ngIf="!formGroup.controls['adress'].valid || formGroup.controls['adress'].touched">
+                {{ getErrorAdress() }}
+              </mat-error>
+            </mat-form-field>
+          </div>
+
+          <div class="row justify-content-center">
+            <mat-form-field class="col-10">
+              <input matInput placeholder="Adresse email :" formControlName="email" required>
+              <mat-error *ngIf="!formGroup.controls['email'].valid || formGroup.controls['email'].touched">
+                {{ getErrorEmail() }}
+              </mat-error>
+            </mat-form-field>
+          </div>
+          <div class="row justify-content-center">
+            <mat-form-field class="col-10">
+              <input matInput placeholder="Mot de passe :" formControlName="password" [type]="hide ? 
+              'password' : 'text'" required>
+              <mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 
+                'visibility'}}</mat-icon>
+              <mat-error *ngIf="!formGroup.controls['password'].valid || formGroup.controls['password'].touched">
+                {{ getErrorPassword() }}
+              </mat-error>
+            </mat-form-field>
+          </div>
+          <div class="row justify-content-center">
+            <mat-form-field class="col-10">
+              <input matInput placeholder="Confirmer le mot de passe :" formControlName="confirmPassword"  [type]="hide ? 
+              'password' : 'text'" required>
+              <mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 
+                'visibility'}}</mat-icon>
+                <mat-error *ngIf="!formGroup.controls['password'].valid || formGroup.controls['password'].touched">
+                {{ getErrorConfirmPassword() }}
+            </mat-error>
+            </mat-form-field>
+          </div>
+
+
+          <div class="row justify-content-center mt-3">
+            <button class="col-6 color-theme" mat-raised-button color="primary" type="submit">S'inscrire</button>
+          </div>
+          <p class="row justify-content-center mt-3">Vous avez un compte?<a class="ml-1" routerLink="/login">Se connecter</a></p>
+        </form>
+      </mat-card-content>
+    </mat-card>
 
-  
-            <div class="row justify-content-center mt-3">
-              <button class="col-6 color-theme" mat-raised-button color="primary" type="submit">S'inscrire</button>
-            </div>
-            <p class="row justify-content-center mt-3">Vous avez un compte?<a class="ml-1" routerLink="/login">Se connecter</a></p>
-          </form>
-        </mat-card-content>
-      </mat-card>
-  
-      
-      
-  
-  
-    </div>
-  
     
     
+
+
+  </div>
+
   
   
-  
-  </div>
+
+
+
+</div>

+ 3 - 0
angular-client/src/app/components/register/register.component.ts

@@ -157,6 +157,9 @@ export class RegisterComponent implements OnInit {
         console.log(data)
         this.loading = false;
         this.router.navigate(['/auth']);
+        setTimeout(() => {
+          document.location.reload()
+        },2000)
     },
     err => {
         this.loading = false;

+ 8 - 8
angular-client/src/app/services/auth.service.ts

@@ -1,4 +1,4 @@
-//import { environment } from 'src/environments/environment';
+import { environment } from 'src/environments/environment';
 import { User } from './../models/userResponse';
 import { Token, payloadToken } from './../models/token';
 import { Injectable } from '@angular/core';
@@ -17,7 +17,7 @@ import * as jwt_decode from 'jwt-decode';
 export class AuthService {
 
   //url api
- // private apiUrl = environment.apiUrl
+ private apiUrl = environment.apiUrl
 
 
   private tokenSubject: BehaviorSubject<Token>;
@@ -58,7 +58,7 @@ export class AuthService {
      //debugger;
    // console.log("url ========",this.apiUrl);
 
-    return this.http.post<Token>(`https://api-prod.foodgame.fr/api/auth/login`, credentials)
+    return this.http.post<Token>(`${this.apiUrl}/auth/login`, credentials)
       .pipe(map(token => {
         // store jwt token in local storage 
         localStorage.setItem('token', JSON.stringify(token));
@@ -83,7 +83,7 @@ export class AuthService {
        //debugger;
       //console.log("url ========",this.apiUrl);
   
-      return this.http.post<Token>(`https://api-prod.foodgame.fr/api/auth/admin`, credentials)
+      return this.http.post<Token>(`${this.apiUrl}/auth/admin`, credentials)
         .pipe(map(token => {
           // store jwt token in local storage 
           localStorage.setItem('token', JSON.stringify(token));
@@ -100,7 +100,7 @@ export class AuthService {
     // console.log("url ========",this.apiUrl);
   
 
-    return this.http.post<Token>(`https://api-prod.foodgame.fr/api/auth/signup`, data)
+    return this.http.post<Token>(`${this.apiUrl}/auth/signup`, data)
       .pipe(map(token => {
         // store jwt token in local storage 
         localStorage.setItem('token', JSON.stringify(token));
@@ -113,13 +113,13 @@ export class AuthService {
 
 // mot de passe oublie 
 lostPassword(email): Observable<any> {
-  return this.http.put<any>(`https://api-prod.foodgame.fr/api/auth/forgot-password`, email)
+  return this.http.put<any>(`${this.apiUrl}/auth/forgot-password`, email)
 }
 
 
 // réinitialiser mot de passe  
 resetPassword(data): Observable<any> {
-  return this.http.put<any>(`https://api-prod.foodgame.fr/api/auth/reset-password`, data)
+  return this.http.put<any>(`${this.apiUrl}/auth/reset-password`, data)
 }
 
   // isLoggedIn
@@ -145,7 +145,7 @@ resetPassword(data): Observable<any> {
   getUserInfo(): Observable<User> {
     
     let decodedToken : payloadToken = jwt_decode(this.tokenSubject.value.token); 
-    return this.http.get<User>(`https://api-prod.foodgame.fr/api/users/${decodedToken.userId}`)
+    return this.http.get<User>(`${this.apiUrl}/users/${decodedToken.userId}`)
       .pipe(map(user => {
         // store user info in local storage 
         localStorage.setItem('user', JSON.stringify(user));

+ 1 - 1
angular-client/src/app/services/statistic.service.ts

@@ -28,7 +28,7 @@ private headers = new HttpHeaders(
 getStatistic(): Observable<StatisticResponse> {
 //  return this.http.get<StatisticResponse>('assets/data/stat.json');
 const options = { headers: this.headers};
- let data = this.http.get<StatisticResponse>('http://localhost:4000/api/tickets/stats',options);
+ let data = this.http.get<StatisticResponse>('https://api-prod.foodgame.fr/api/tickets/stats',options);
  console.log(JSON.stringify(data));
  return data;
  

+ 3 - 3
build/docker/httpd/httpd.conf

@@ -227,8 +227,8 @@ Group daemon
 <VirtualHost *:80>
     # Le premier serveur virtuel de la liste est aussi le
     # serveur par défaut pour *:80
-    ServerName www.angular-preprod.foodgame.fr
-    ServerAlias angular-preprod.foodgame.fr
+    ServerName www.angular-prod.foodgame.fr
+    ServerAlias angular-prod.foodgame.fr
     DocumentRoot "/usr/local/apache2/htdocs/"
     <Directory /usr/local/apache2/htdocs/>
         Options +Indexes +FollowSymlinks
@@ -252,7 +252,7 @@ ServerAdmin you@example.com
 #
 # If your host doesn't have a registered DNS name, enter its IP address here.
 #
-ServerName angular-preprod.foodgame.fr
+ServerName angular-prod.foodgame.fr
 
 #
 # Deny access to the entirety of your server's filesystem. You must

+ 2 - 2
docker-compose.yml

@@ -65,8 +65,8 @@ services:
 #   container_name: apache_"${ENV}"    
     build:  
       context: ./
-      #dockerfile: build/docker/httpd/Dockerfile
-      dockerfile: build/docker/apache/Dockerfile
+      dockerfile: build/docker/httpd/Dockerfile
+      #dockerfile: build/docker/apache/Dockerfile
     ports:
       - "8080:80"
     networks:

+ 0 - 2
express-server/lib/db.js

@@ -8,8 +8,6 @@ const  config  = require('../config/config.json');
 //const db = config.url;
 
 var db = 'mongodb://database_prod:27017/mean-fatboar-db';
-//var mongoURI = 'mongodb://localhost:27017/my-db';
-//mongoose.set('useCreateIndex', true)
 mongoose.connect(db, {useNewUrlParser: true, useUnifiedTopology: true })
 .then(() => {
     console.log("Successfully connected to the database.");

+ 2 - 2
express-server/routes/google.js

@@ -87,7 +87,7 @@ passport.deserializeUser((obj, cb) => {
 passport.use(new GoogleStrategy({
   clientID: "493465923713-qrbgtq8d53iguine1gf928483mn4odes.apps.googleusercontent.com",
   clientSecret: "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",
-  callbackURL: "http://localhost:4000/api/auth/google/callback"
+  callbackURL: "https://api-prod.foodgame.fr/api/auth/google/callback"
 },
 async (req, accessToken, refreshToken, profile, cb) => {
 
@@ -141,7 +141,7 @@ router.get('/callback',  passport.authenticate('google', { failureRedirect: '/fa
       const token = jwt.sign({ userId: req.user._id, email: req.user.email, role: req.user.role }, process.env.SECRET_KEY, { expiresIn: '10 h' })
        //res.status(200).json({ success: true, token, expireIn: `${new Date().getTime() + 120000}` })
       console.log(token) 
-      res.redirect(`${process.env.URL}/auth/?token=${token}`);
+      res.redirect(`https://angular-prod.foodgame.fr/auth/?token=${token}`);
     });