Skip to content

Instantly share code, notes, and snippets.

View blogcacanid's full-sized avatar

Rony Chandra Kudus blogcacanid

  • cacan.id
  • Jakarta
View GitHub Profile
@blogcacanid
blogcacanid / app.component.html
Created November 9, 2020 22:06
app.component.html Authentication JWT Angular 9 Lumen 7
<div id="app">
<nav class="navbar navbar-expand navbar-dark bg-dark">
<div class="container">
<a href="#" class="navbar-brand">
<img
width="32"
alt="Angular Logo"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="
/>
Angular 9 LOGIN JWT
@blogcacanid
blogcacanid / app.component.ts
Created November 9, 2020 22:05
app.component.ts Authentication JWT Angular 9 Lumen 7
import { Component } from '@angular/core';
import { TokenStorageService } from './_services/token-storage.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'ang9-auth-jwt-lumen7';
@blogcacanid
blogcacanid / app.module.ts
Created November 9, 2020 22:04
app.module.ts Authentication JWT Angular 9 Lumen 7
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';
import { RegisterComponent } from './register/register.component';
import { LoginComponent } from './login/login.component';
@blogcacanid
blogcacanid / home.component.html
Created November 9, 2020 22:03
home.component.html Authentication JWT Angular 9 Lumen 7
<div class="container">
<header class="jumbotron">
<p>{{ content }}</p>
</header>
</div>
@blogcacanid
blogcacanid / home.component.ts
Created November 9, 2020 22:02
home.component.ts Authentication JWT Angular 9 Lumen 7
import { Component, OnInit } from '@angular/core';
import { UserService } from '../_services/user.service';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
@blogcacanid
blogcacanid / profile.component.html
Created November 9, 2020 22:01
profile.component.html Authentication JWT Angular 9 Lumen 7
<div class="container" *ngIf="currentUser; else loggedOut">
<header class="jumbotron">
<h3>Profile</h3>
<h3>
<strong>{{ currentUser.username }}</strong>
</h3>
<p>
<strong>Id:</strong>
{{ currentUser.id }}
</p>
@blogcacanid
blogcacanid / profile.component.ts
Created November 9, 2020 22:00
profile.component.ts Authentication JWT Angular 9 Lumen 7
import { Component, OnInit } from '@angular/core';
import { TokenStorageService } from '../_services/token-storage.service';
@Component({
selector: 'app-profile',
templateUrl: './profile.component.html',
styleUrls: ['./profile.component.css']
})
export class ProfileComponent implements OnInit {
@blogcacanid
blogcacanid / login.component.css
Created November 9, 2020 21:59
login.component.css Authentication JWT Angular 9 Lumen 7
label {
display: block;
margin-top: 10px;
}
.card-container.card {
max-width: 400px !important;
padding: 40px 40px;
}
@blogcacanid
blogcacanid / login.component.html
Created November 9, 2020 21:58
login.component.html Authentication JWT Angular 9 Lumen 7
<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="!isLoggedIn"
name="form"
@blogcacanid
blogcacanid / login.component.ts
Created November 9, 2020 21:56
login.component.ts Authentication JWT Angular 9 Lumen 7
import { Component, OnInit } from '@angular/core';
import { AuthService } from '../_services/auth.service';
import { TokenStorageService } from '../_services/token-storage.service';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {