This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.use(function(req, res, next){ | |
| //check header or url parameters or post parameters for token | |
| var token = req.body.token || req.query['token'] || req.headers['x-access-token']; | |
| //decode token | |
| if(token){ | |
| //verifiy secret | |
| jwt.verify(token, config.SECRET, function(err, decoded){ | |
| if(err){ | |
| return res.status(401).send({ | |
| message: 'Failed to authenticate token.' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interceptBefore(request: InterceptedRequest): InterceptedRequest { | |
| this.blockUI.load(); | |
| var token = this.auth.getToken(); | |
| if(token) { | |
| request.options.headers.set('x-access-token',token); | |
| } | |
| return request; | |
| } | |
| public interceptAfter(response): InterceptedResponse { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Injectable() | |
| export class AuthService { | |
| private token: string; | |
| private _user: BehaviorSubject<any>; | |
| private dataStore; | |
| user: Observable<any>; | |
| private init() { | |
| // create observable and subject |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h2>Login</h2> | |
| <md-input-container> | |
| <input mdInput placeholder="Username" [(ngModel)]="username"> | |
| </md-input-container> | |
| <nav md-tab-nav-bar aria-label="weather navigation links"> | |
| <a md-tab-link | |
| [class.active]="loginMethod === 'camera'" | |
| (click)="loginMethod='camera'"> | |
| Camera | |
| </a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // login method | |
| login() { | |
| // set params: password or imageUrl, depending on chosen loginMethod | |
| var params: any = { | |
| username: this.username | |
| }; | |
| if(this.loginMethod === 'password') { | |
| params.password = this.password; | |
| } | |
| else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h1>Working experience</h1> | |
| <mgl-timeline> | |
| <mgl-timeline-entry *ngFor="let job of data.jobs"> | |
| <mgl-timeline-entry-header> | |
| <div class="title">{{job.title}}</div> | |
| <div class="subtitle">{{job.company}}</div> | |
| </mgl-timeline-entry-header> | |
| <mgl-timeline-entry-content> | |
| <ul> | |
| <li *ngFor="let task of job.tasks">{{task}}</li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { MglTimelineEntryHeaderComponent } from './timeline-entry-header/timeline-entry-header.component'; | |
| import { MglTimelineEntryDotComponent } from './timeline-entry-dot/timeline-entry-dot.component'; | |
| import { MglTimelineEntryContentComponent } from './timeline-entry-content/timeline-entry-content.component'; | |
| import { MglTimelineEntrySideComponent } from './timeline-entry-side/timeline-entry-side.component'; | |
| import { MglTimelineEntryComponent } from './timeline-entry/timeline-entry.component'; | |
| import { MglTimelineComponent } from './timeline/timeline.component'; | |
| import { NgModule } from '@angular/core'; | |
| @NgModule({ | |
| declarations: [ | |
| MglTimelineComponent, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { MglTimelineModule } from '../timeline/timeline.module'; | |
| import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | |
| import { BrowserModule } from '@angular/platform-browser'; | |
| import { NgModule } from '@angular/core'; | |
| import { AppComponent } from './app.component'; | |
| @NgModule({ | |
| declarations: [ | |
| AppComponent | |
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class PausableComponent { | |
| private detectChanges; | |
| private getCdr() { | |
| const cdrKey = Object.keys(this).find(key => this[key] &&typeof this[key].detectChanges === 'function'); | |
| return cdrKey && this[cdrKey]; | |
| } | |
| pause() { |