redesigned verify email view
lbs-gitea/maptology/master This commit looks good

This commit is contained in:
ilhangeoksu
2018-02-03 19:54:14 +01:00
parent f0b75c6129
commit 9e4333227e
3 changed files with 45 additions and 28 deletions
@@ -120,19 +120,19 @@ export class PlaceComponent implements OnInit {
}
getPlaces(){
let requestList:[Observable<HttpResponse<Place>>];
let observableList:[Observable<HttpResponse<Place>>];
for(let visit of this.visits){
requestList.push(this.apiClientService.getPlace(visit.place).map((response: any) => response.e.body));
observableList.push(this.apiClientService.getPlace(visit.place));
}
Observable.forkJoin(requestList).subscribe(responseList => {
Observable.forkJoin(...observableList).subscribe(responseList => {
console.log("------------------------------");
console.log("------------------------------");
console.log(responseList);
var i =0;
for(i=0; i<responseList.length; i++){
// this.places.push(responseList[i].body);
this.places.push(responseList[i].body);
}
// this.setMarkersForPlaces();
this.setMarkersForPlaces();
}, error => {
this.consoleService.log("Error during get places.");
this.helperService.handleError(error);
@@ -1,16 +1,39 @@
<div *ngIf="verified && !this.loading">
<h3>Email successful verified!</h3>
</div>
<div class="app flex-row align-items-center">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<div *ngIf="!verified && !this.loading">
<h3>Error: {{errorMessage}}</h3>
</div>
<!-- success view -->
<div *ngIf="verified && !this.loading" class="clearfix">
<h1 class="pt-3">Herzlich willkommen bei Maptology!</h1>
<div class="row" *ngIf="this.loading">
<div class="col text-center">
<h1>
<i class="fa fa-spinner fa-pulse fa-fw"></i>
<span class="sr-only">Loading...</span>
</h1>
<h3 class="pt-3">Deine Email wurde erfolgreich verifiziert!</h3>
<p class="text-muted">Sie werden in Kürze zum Login weitergeleitet...</p>
</div>
<!-- Error view -->
<div *ngIf="!verified && !this.loading" class="clearfix">
<h1 class="float-left display-3 mr-4">403</h1>
<h4 class="pt-3">Oops! Token nicht gültig.</h4>
<p class="text-muted">{{errorMessage}}</p>
</div>
<!-- Loading spinner -->
<div class="row" *ngIf="this.loading">
<div class="col text-center">
<h1>
<i class="fa fa-spinner fa-pulse fa-fw"></i>
<span class="sr-only">Loading...</span>
</h1>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -11,18 +11,15 @@ import {HelperService} from "../../../Utils/helper.service";
encapsulation: ViewEncapsulation.None
})
export class VerifyEmailComponent implements OnInit {
token:string;
public loading: boolean = false;
errorMessage: string;
verified:boolean = false;
constructor(private consoleService: ConsoleService,
private route: ActivatedRoute,
private apiClientService:ApiClientService,
private router: Router,
private helperService:HelperService) { }
private router: Router) { }
ngOnInit() {
// Fetch token from url
@@ -30,23 +27,20 @@ export class VerifyEmailComponent implements OnInit {
this.verifyEmail();
}
verifyEmail(): void {
verifyEmail() {
this.loading = true;
this.apiClientService.verifyUserEmail(this.token).subscribe(result => {
this.consoleService.log("Email verification received.");
this.verified = true;
this.loading = false;
setTimeout(() => {
this.router.navigate(['/pages/login']);
}, 1000);
// this.user.next(result.body);
}, 3000);
}, error => {
this.consoleService.log(error);
this.loading = false;
this.verified = false;
this.consoleService.log("Error during verify email.");
this.helperService.handleError(error);
this.errorMessage = "Entweder ist der Token falsch eingegeben oder der Token ist nicht mehr gütlig";
});
}
}