This file contains 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, ViewChildren, ElementRef, AfterViewInit } from '@angular/core'; | |
import { FormGroup, FormBuilder, Validators, FormControlName } from '@angular/forms'; | |
import { Observable, fromEvent, merge } from 'rxjs'; | |
import { debounceTime } from 'rxjs/operators'; | |
import { GenericValidator } from '../../shared/generic-validator'; | |
@Component({ | |
selector: 'app-login', | |
templateUrl: './login.component.html', | |
styleUrls: ['./login.component.scss'] |
This file contains 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, ViewChildren, ElementRef, AfterViewInit } from '@angular/core'; | |
import { FormGroup, FormBuilder, Validators, FormControlName, AbstractControl } from '@angular/forms'; | |
import { Observable, fromEvent, merge } from 'rxjs'; | |
import { debounceTime } from 'rxjs/operators'; | |
import { GenericValidator } from '../../shared/generic-validator'; | |
import { PasswordMatcher } from '../../shared/password-matcher'; | |
@Component({ | |
selector: 'app-sign-up', | |
templateUrl: './sign-up.component.html', |
This file contains 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 class="title is-4">Login</h1> | |
<p class="description">Welcome back!</p> | |
<form (ngSubmit)="login()" [formGroup]="loginForm" novalidate autocomplete="false"> | |
<div class="field"> | |
<div class="control"> | |
<input [ngClass]="{'is-danger': displayMessage.email}" class="input is-medium" type="email" placeholder="Email" formControlName="email"> | |
<p *ngIf="displayMessage.email" class="help is-danger"> | |
{{ displayMessage.email }} | |
</p> | |
</div> |
This file contains 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 { FormGroup, FormBuilder, Validators } from '@angular/forms'; | |
@Component({ | |
selector: 'app-login', | |
templateUrl: './login.component.html', | |
styleUrls: ['./login.component.scss'] | |
}) | |
export class LoginComponent implements OnInit, AfterViewInit { | |
loginForm: FormGroup; |
This file contains 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 class="title is-4">Sign Up</h1> | |
<p class="description">Let's get started!</p> | |
<form (ngSubmit)="signup()" [formGroup]="signupForm" novalidate autocomplete="false"> | |
<div class="field"> | |
<div class="control"> | |
<input [ngClass]="{'is-danger': displayMessage.firstName}" formControlName="firstName" class="input is-medium" type="text" placeholder="First Name"> | |
<p *ngIf="displayMessage.firstName" class="help is-danger"> | |
{{ displayMessage.firstName }} | |
</p> | |
</div> |
This file contains 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 { FormGroup, FormBuilder, Validators } from '@angular/forms'; | |
import { PasswordMatcher } from '../../shared/password-matcher'; | |
@Component({ | |
selector: 'app-sign-up', | |
templateUrl: './sign-up.component.html', | |
styleUrls: ['./sign-up.component.scss'] | |
}) |
This file contains 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 { AbstractControl } from '@angular/forms'; | |
export class PasswordMatcher { | |
static match(control: AbstractControl): void | null { | |
const passwordControl = control.get('password'); | |
const confirmPasswordControl = control.get('confirmPassword'); | |
if (passwordControl.pristine || confirmPasswordControl.pristine) { | |
return null; | |
} |
This file contains 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 { FormGroup } from '@angular/forms'; | |
// Provide all set of validation messages here | |
const VALIDATION_MESSAGES = { | |
email: { | |
required: 'Required', | |
email: 'This email is invalid' | |
}, | |
password: { | |
required: 'Required', |
This file contains 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 { BrowserModule } from '@angular/platform-browser'; | |
import { NgModule } from '@angular/core'; | |
import { ReactiveFormsModule } from '@angular/forms'; | |
import { AppRoutingModule } from './app-routing.module'; | |
import { AppComponent } from './app.component'; | |
import { LoginComponent } from './modules/login/login.component'; | |
import { SignUpComponent } from './modules/sign-up/sign-up.component'; | |
@NgModule({ |
This file contains 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 { Controller, Body, Post, UseGuards, Request } from '@nestjs/common'; | |
import { AuthGuard } from '@nestjs/passport'; | |
import { AuthService } from './auth.service'; | |
import { UserDto } from '../users/dto/user.dto'; | |
@Controller('auth') | |
export class AuthController { | |
constructor(private authService: AuthService) {} |
NewerOlder