email verification OK email personnalisé PAS OK

thierry
Tmadkaud 7 years ago
parent 2dafd999b5
commit 092d642c2b

@ -1,57 +1,59 @@
{
"name": "quickstart-angular2",
"version": "4.2.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.0",
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"angular-bootstrap-md": "*",
"angularfire2": "^4.0.0-rc.1",
"chart.js": "2.5.0",
"classlist.js": "^1.1.20150312",
"core-js": "^2.4.1",
"easy-pie-chart": "^2.1.7",
"firebase": "^4.2.0",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"rxjs": "^5.1.0",
"screenfull": "^3.2.0",
"web-animations-js": "^2.2.5",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}
{
"name": "quickstart-angular2",
"version": "4.2.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.0",
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"angular-bootstrap-md": "*",
"angularfire2": "^4.0.0-rc.1",
"chart.js": "2.5.0",
"classlist.js": "^1.1.20150312",
"core-js": "^2.4.1",
"easy-pie-chart": "^2.1.7",
"firebase": "^4.2.0",
"firebase-functions": "^0.6.3",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"nodemailer": "^4.1.0",
"rxjs": "^5.1.0",
"screenfull": "^3.2.0",
"web-animations-js": "^2.2.5",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}

@ -32,6 +32,7 @@ export class ProfilComponent implements OnInit, OnDestroy {
profileData: FirebaseListObservable<any[]>;
imageProfil: string;
constructor(public afAuth: AngularFireAuth, public afDb: AngularFireDatabase,
private router: Router, private authService: AuthService) {
this.localUser = new User();

@ -23,6 +23,7 @@ export class RegisterComponent implements OnInit, OnDestroy {
ConfirmPasswordCommercant: String;
test: boolean;
constructor(private router: Router, private authService: AuthService) {
this.currentUser = new User();
this.parrain = new Parrain();

@ -6,6 +6,8 @@ import { HttpModule, Headers } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import * as firebase from 'firebase/app';
// import * as functions from 'firebase-functions';
// import * as functions from 'firebase/functions';
import { AngularFireAuth } from 'angularfire2/auth';
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
@ -14,9 +16,13 @@ import { Parrain } from '../../../models/Parrain';
import { Image } from '../../../models/Image';
import { Commercant } from '../../../models/Commercant';
//import * as NodeMailer from 'nodemailer/lib/nodemailer';
@Injectable()
export class AuthService {
//nodemailer: NodeMailer;
databaseRef: any;
storageRef: any;
changeRequest: any;
@ -24,12 +30,14 @@ export class AuthService {
parrain: Parrain;
commercant: Commercant;
test: string;
uti: firebase.User;
@Input() folder: string;
//fileList: FirebaseListObservable<Image[]>;
constructor(private http: HttpModule, public afAuth: AngularFireAuth, public afDb: AngularFireDatabase, public router: Router) {
this.databaseRef = firebase.database().ref();
//var nodemailer = require('nodemailer');
}
saveInfo(user: firebase.User, infoUser: any) {
@ -54,13 +62,18 @@ export class AuthService {
signIn(email: string, password: string) {
firebase.auth().signInWithEmailAndPassword(email, password).then(user => {
if (user) {
console.log('salut le ' + user.displayName + ' ' + user.email + ' has signed!');
if (user.displayName === 'Parrain') {
this.router.navigate(['/carteParrainageComponent']);
}
else if (user.displayName === 'Commercant') {
this.router.navigate(['/opCommercial']);
if (user.emailVerified){
console.log('salut le ' + user.displayName + ' ' + user.email + ' has signed!');
if (user.displayName === 'Parrain') {
this.router.navigate(['/carteParrainageComponent']);
}
else if (user.displayName === 'Commercant') {
this.router.navigate(['/opCommercial']);
}
}else{
console.log('email non verifié!!');
}
}else {
console.log('error!!');
}
@ -86,10 +99,19 @@ export class AuthService {
signUp(infoUser: any) {
firebase.auth().createUserWithEmailAndPassword(infoUser.email, infoUser.password).then(userCreate => {
userCreate.sendEmailVerification().then(res => {
console.log('res : ');
});
this.sendEmail();
this.setUserInfo(userCreate, infoUser);
});
}
sendEmail() {
}
logout() {
firebase.auth().signOut();
}

@ -0,0 +1,25 @@
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'youremail@gmail.com',
pass: 'yourpassword'
}
});
var mailOptions = {
from: 'youremail@gmail.com',
to: 'myfriend@yahoo.com',
subject: 'Sending Email using Node.js',
text: 'That was easy!'
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
Loading…
Cancel
Save