edit profil fonctionnel v2

thierry
Viiciouss 7 years ago
parent 0d83c487d1
commit 9fbc343eec

@ -24,6 +24,7 @@ import { OpCommercialComponent } from './components/opCommercial/op-commercial/o
import { CreationOpComComponent } from './components/opCommercial/creation-op-com/creation-op-com.component';
import { CarteParrainageComponent } from './components/carteParrainage/carte-parrainage/carte-parrainage.component';
import { EnvoyerCarteComponent } from './components/opCommercial/envoyer-carte/envoyer-carte.component';
import { EditProfilComponent } from './components/profil/edit-profil/edit-profil.component'
@NgModule({
@ -37,7 +38,8 @@ import { EnvoyerCarteComponent } from './components/opCommercial/envoyer-carte/e
OpCommercialComponent,
CreationOpComComponent,
CarteParrainageComponent,
EnvoyerCarteComponent
EnvoyerCarteComponent,
EditProfilComponent
],
imports: [
BrowserModule,

@ -6,6 +6,7 @@ import { OpCommercialComponent } from './components/opCommercial/op-commercial/o
import { CreationOpComComponent } from './components/opCommercial/creation-op-com/creation-op-com.component';
import { CarteParrainageComponent } from './components/carteParrainage/carte-parrainage/carte-parrainage.component';
import { EnvoyerCarteComponent } from './components/opCommercial/envoyer-carte/envoyer-carte.component';
import { EditProfilComponent } from './components/profil/edit-profil/edit-profil.component'
export const AppRoutes = [
{path: '', component: HomeComponent},
@ -16,4 +17,5 @@ export const AppRoutes = [
{path: 'creationOpCommercial', component: CreationOpComComponent},
{path: 'carteParrainageComponent', component: CarteParrainageComponent},
{path: 'EnvoyerCarte/:idOp', component: EnvoyerCarteComponent},
{path: 'editProfil', component: EditProfilComponent}
];

@ -19,13 +19,6 @@
<div *ngIf="(user | async)?.displayName === 'Parrain'" >
<button class="btn btn-deep-orange" (click)="modifyPasswordSection()">Modifier Email/Mot de passe</button>
<div class="card" *ngIf="modifiermdp">
<div class="md-form">
<i class="fa fa-envelope prefix grey-text"></i>
<input type="email" id="orangeForm-email" [(ngModel)]="parrain.email" placeholder="{{parrain.email}}" name="email" required pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$" #email="ngModel">
<div *ngIf="email.errors && email.errors.pattern && (email.dirty || email.touched)" class="alert alert-danger">
Email is required and format should be <strong><i>john@parrain.fr</i></strong>.
</div>
</div>
<div class="md-form">
<i class="fa fa-lock prefix grey-text"></i>
<input id="orangeForm-passC" type="password" [(ngModel)]="confirmOldPassword" placeholder="Tapez votre ancien mot de passe" name="confirmOldPasswordPar" #confirmOldPasswordPar="ngModel">
@ -34,6 +27,13 @@
</div>
</div>
<div *ngIf="modifiermdp && (parrain.password === confirmOldPassword)">
<div class="md-form">
<i class="fa fa-envelope prefix grey-text"></i>
<input type="email" id="orangeForm-email" [(ngModel)]="parrain.email" placeholder="{{parrain.email}}" name="email" required pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$" #email="ngModel">
<div *ngIf="email.errors && email.errors.pattern && (email.dirty || email.touched)" class="alert alert-danger">
Email is required and format should be <strong><i>john@parrain.fr</i></strong>.
</div>
</div>
<div class="md-form">
<i class="fa fa-lock prefix grey-text"></i>
<input id="orangeForm-pass" type="password" [(ngModel)]="newPassword" placeholder="Nouveau mot de passe" name="password" #password= "ngModel" required minlength="5">

@ -131,21 +131,38 @@ export class AuthService {
console.log('delete');
/*
let storagePath = image.path;
let referencePath = `${this.folder}/images/` + image.key;
let storagePath = image.path;
let referencePath = `${this.folder}/images/` + image.key;
// Do these as two separate steps so you can still try delete ref if file no longer exists
// Do these as two separate steps so you can still try delete ref if file no longer exists
// Delete from Storage
firebase.storage().ref().child(storagePath).delete()
.then(
() => {},
(error) => console.error('Error deleting stored file', storagePath)
);
// Delete from Storage
firebase.storage().ref().child(storagePath).delete()
.then(
() => {},
(error) => console.error('Error deleting stored file', storagePath)
);
// Delete references
this.afDb.object(referencePath).remove();
*/
}
modifyProfile(user: User, infoUser: any) {
if (infoUser.status === 'Parrain') {
const userRef = this.databaseRef.child('Parrain').child(user.uid);
// var parrainInfo = infoUser;
infoUser.uid = user.uid;
userRef.update(infoUser);
// this.upload(infoUser);
}else if (infoUser.status === 'Commercant') {
const userReff = this.databaseRef.child('Commercant').child(user.uid);
// var commercantInfo = infoUser;
infoUser.uid = user.uid;
userReff.update(infoUser);
// this.upload(infoUser);
}
// Delete references
this.afDb.object(referencePath).remove();
*/
}
}

Loading…
Cancel
Save