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
label { | |
display: block; | |
margin-top: 10px; | |
} | |
.card-container.card { | |
max-width: 400px !important; | |
padding: 40px 40px; | |
} |
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
<div class="col-md-12"> | |
<div class="card card-container"> | |
<img | |
id="profile-img" | |
src="//ssl.gstatic.com/accounts/ui/avatar_2x.png" | |
class="profile-img-card" | |
/> | |
<form | |
*ngIf="!isSuccessful" | |
name="form" |
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 '../_services/auth.service'; | |
@Component({ | |
selector: 'app-register', | |
templateUrl: './register.component.html', | |
styleUrls: ['./register.component.css'] | |
}) | |
export class RegisterComponent implements OnInit { |
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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Ang9AuthJwtLumen7</title> | |
<base href="/"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="icon" type="image/x-icon" href="favicon.ico"> | |
<link | |
rel="stylesheet" |
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 { HTTP_INTERCEPTORS } from '@angular/common/http'; | |
import { Injectable } from '@angular/core'; | |
import { HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http'; | |
import { TokenStorageService } from '../_services/token-storage.service'; | |
// for Lumen 7 back-end | |
const TOKEN_HEADER_KEY = 'Authorization'; | |
// for Node.js Express back-end | |
// const TOKEN_HEADER_KEY = 'x-access-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
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
// for Lumen 7 back-end | |
const API_URL = 'http://localhost:8000/api/test/'; | |
// for Node.js back-end | |
// const API_URL = 'http://localhost:9090/api/test/'; | |
@Injectable({ |
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'; | |
const TOKEN_KEY = 'auth-token'; | |
const USER_KEY = 'auth-user'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class TokenStorageService { |
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 { HttpClient, HttpHeaders } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
// for Lumen 7 back-end | |
const AUTH_API = 'http://localhost:8000/api/auth/'; | |
// for Node.js back-end | |
// const AUTH_API = 'http://localhost:9090/api/auth/'; | |
const httpOptions = { |
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
<template> | |
<div id="app"> | |
<nav class="navbar navbar-expand navbar-dark bg-dark"> | |
<div class="container"> | |
<a href class="navbar-brand" @click.prevent> | |
<img alt="Vue logo" src="./assets/logo.png" width="32"> | |
VUE LOGIN JWT | |
</a> | |
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> | |
<span class="navbar-toggler-icon"></span> |
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 Vue from 'vue'; | |
import Router from 'vue-router'; | |
import Home from './views/Home.vue'; | |
import Login from './views/Login.vue'; | |
import Register from './views/Register.vue'; | |
Vue.use(Router); | |
export const router = new Router({ | |
mode: 'history', |