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
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>AngularAuth</title> | |
| <base href="/"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" |
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 { PageNotFoundComponent } from './page-not-found/page-not-found.component'; | |
| import { LoginComponent } from './login/login.component'; | |
| import {Routes} from '@angular/router'; | |
| export const APP_ROUTES: Routes = [ | |
| { path: 'login', component: LoginComponent }, | |
| { path: '**', component: PageNotFoundComponent } | |
| ]; |
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
| imports: [ | |
| BrowserModule, | |
| FormsModule, | |
| HttpModule, | |
| RouterModule.forRoot(APP_ROUTES) | |
| ], |
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 { Injectable } from '@angular/core'; | |
| import { Http, ConnectionBackend, RequestOptions, RequestMethod, RequestOptionsArgs, Headers } from "@angular/http"; | |
| import { Observable } from "rxjs/Observable"; | |
| import { environment } from "environments/environment"; | |
| import 'rxjs/add/operator/catch'; | |
| import 'rxjs/add/observable/throw'; | |
| @Injectable() | |
| export class ApiHandler extends Http { |
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 interface IUser { | |
| id: string; | |
| name: string; | |
| roles: string[]; | |
| email: string; | |
| } |
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 {Injectable} from '@angular/core'; | |
| import {IUser} from "../interfaces/iuser"; | |
| @Injectable() | |
| export class UserService { | |
| private user: IUser; | |
| constructor() { | |
| } |
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 {IUser} from "../interfaces/iuser"; | |
| /** | |
| * @credits for helper class goes to https://github.com/auth0/angular2-jwt | |
| */ | |
| export class JwtHelper { | |
| public urlBase64Decode(str: string): string { | |
| let output = str.replace(/-/g, '+').replace(/_/g, '/'); |
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 {Injectable} from '@angular/core'; | |
| import {UserService} from "./user.service"; | |
| import {ApiHandler} from "./api-handler.service"; | |
| import {JwtHelper} from "../helpers/jwt-helper"; | |
| import {Observable} from "rxjs"; | |
| import {RequestMethod} from "@angular/http"; | |
| import 'rxjs/add/operator/do'; | |
| import 'rxjs/add/operator/map'; |
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 {Component, OnInit} from '@angular/core'; | |
| import {AuthService} from "../providers/auth.service"; | |
| import {FormBuilder, Validators} from "@angular/forms"; | |
| import {Router} from "@angular/router"; | |
| @Component({ | |
| selector: 'app-login', | |
| template: `<div class="container"> | |
| <div class="card card-container"> | |
| <form #f="ngForm" [formGroup]="loginForm" (ngSubmit)="submitted()"> |
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 {NgModule} from '@angular/core'; | |
| import {CommonModule} from '@angular/common'; | |
| import {DashboardComponent} from './dashboard/dashboard.component'; | |
| import {HomeComponent} from './home/home.component'; | |
| import {SettingsComponent} from './settings/settings.component'; | |
| import {AdminComponent} from './admin/admin.component'; | |
| import {RouterModule} from "@angular/router"; | |
| import {dashboardRoutes} from "./dashboard.routes"; | |
| @NgModule({ |
OlderNewer