Index: trip-planner-front/src/app/homepage/register/register.component.html
===================================================================
--- trip-planner-front/src/app/homepage/register/register.component.html	(revision bdd64917749115bbdd228a9569a675d590c112e3)
+++ trip-planner-front/src/app/homepage/register/register.component.html	(revision b73803523f0488ec52498c2ba88889f1642ad263)
@@ -2,42 +2,73 @@
     integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
 
-<div class="p-grid p-fluid">
-    <div class="p-col-12 p-md-4">
-        <div class="p-inputgroup">
-            <span class="p-inputgroup-addon"><i class="pi pi-user"></i></span>
-            <input type="text" pInputText placeholder="Full name" [(ngModel)]="user.fullName" name="fullName"
-                class="form-control">
 
+<div class="readersack">
+    <div class="container">
+        <div class="row">
+            <div class="col-md-6 offset-md-3">
+                <form [formGroup]="form" #myform="ngForm" (ngSubmit)="onFormSubmitSignUp(user)">
+                    <div class="form-group">
+                        <label>Full name</label>
+                        <input formControlName="fullName" id="fullName" type="text" class="form-control"
+                            [(ngModel)]="user.fullName"
+                            [ngClass]="{ 'is-invalid': myform.submitted && form.get('fullName')?.errors?.['required']}" />
+                        <div *ngIf="myform.submitted && form.get('fullName')?.errors" class="invalid-feedback">
+                            <div *ngIf="form.get('fullName')?.hasError('required') && myform.submitted">
+                                Full Name is required
+                            </div>
+                        </div>
+
+                        <label>Username (email)</label>
+                        <input formControlName="username" id="username" type="text" class="form-control"
+                            [(ngModel)]="user.username"
+                            [ngClass]="{ 'is-invalid': myform.submitted && (form.get('username')?.errors?.['required'] || 
+                            form.get('username')?.errors?.['email'] || form.get('username')?.hasError('validateUsername'))}" />
+                        <div *ngIf="form.get('username')?.hasError('required') && myform.submitted"
+                            class="invalid-feedback">
+                            Username is required</div>
+                        <div *ngIf="form.get('username')?.hasError('email') && myform.submitted"
+                            class="invalid-feedback">
+                            Please enter valid email.</div>
+                        <div *ngIf="form.get('username')?.hasError('validateUsername') && myform.submitted"
+                            class="invalid-feedback">
+                            Username already exists</div>
+
+
+
+                        <label>Password</label>
+                        <input formControlName="password" id="password" type="password" class="form-control"
+                            [(ngModel)]="user.password" [ngClass]="{ 'is-invalid': myform.submitted && (form.get('password')?.errors?.['required'] ||
+                            form.get('password')?.errors?.['minlength'])}" />
+                        <div *ngIf="form.get('password')?.hasError('required') && myform.submitted"
+                            class="invalid-feedback">
+                            Password is required</div>
+                        <div *ngIf="form.get('password')?.errors?.['minlength'] && myform.submitted"
+                            class="invalid-feedback">
+                            Password must be at least 6 characters long.
+                        </div>
+
+                        <label>Confirm password</label>
+                        <input formControlName="confirmPassword" id="confirmPassword" type="password"
+                            class="form-control" [(ngModel)]="user.confirmPassword"
+                            [ngClass]="{ 'is-invalid': myform.submitted && (form.get('confirmPassword')?.errors?.['required'] || 
+                            form.get('confirmPassword')?.errors?.['minlength'] || form.get('confirmPassword')?.errors?.['mustMatch'])}" />
+                        <div *ngIf="form.get('confirmPassword')?.hasError('required') && myform.submitted"
+                            class="invalid-feedback">
+                            Confirm Password is required</div>
+                        <div *ngIf="form.get('confirmPassword')?.errors?.['minlength'] && myform.submitted"
+                            class="invalid-feedback">
+                            Confirm Password must be at least 6 characters long.
+                        </div>
+                        <div *ngIf="form.get('confirmPassword')?.errors?.['mustMatch'] && myform.submitted"
+                            class="invalid-feedback">Password and confirm password must match
+                        </div>
+
+                        <div class="p-col-12 p-md-4">
+                            <button type="submit" pButton pRipple class="p-button-secondary">Submit</button>
+                        </div>
+                    </div>
+                </form>
+            </div>
         </div>
     </div>
-
-    <div class="p-col-12 p-md-4">
-        <div class="p-inputgroup">
-            <span class="p-inputgroup-addon"><i class="pi pi-user"></i></span>
-            <input type="text" pInputText placeholder="Email address (Username)" [(ngModel)]="user.username"
-                name="username">
-        </div>
-    </div>
-
-    <div class="p-col-12 p-md-4">
-        <div class="p-inputgroup">
-            <span class="p-inputgroup-addon"><i class="pi pi-password"></i></span>
-            <input type="password" pInputText placeholder="Password" [(ngModel)]="user.password" name="password">
-        </div>
-    </div>
-
-    <div class="p-col-12 p-md-4">
-        <div class="p-inputgroup">
-            <span class="p-inputgroup-addon"><i class="pi pi-password"></i></span>
-            <input type="password" pInputText placeholder="Repeat password" [(ngModel)]="user.confirmPassword"
-                name="confirmPassword">
-        </div>
-    </div>
-
-    <div class="p-col-12 p-md-4">
-        <button pButton pRipple label="Submit" class="p-button-secondary" type="button"
-            (click)="onFormSubmitSignUp(user)"></button>
-    </div>
 </div>
-
-
Index: trip-planner-front/src/app/homepage/register/register.component.ts
===================================================================
--- trip-planner-front/src/app/homepage/register/register.component.ts	(revision bdd64917749115bbdd228a9569a675d590c112e3)
+++ trip-planner-front/src/app/homepage/register/register.component.ts	(revision b73803523f0488ec52498c2ba88889f1642ad263)
@@ -1,6 +1,8 @@
 import { Component, OnInit } from '@angular/core';
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
 import { DynamicDialogRef } from 'primeng/dynamicdialog';
+import { CustomValidators } from 'src/app/providers/CustomValidators';
 import { UserDto } from 'src/app/_models/dto/userDto';
+import { UserService } from 'src/app/_services/user.service';
 
 @Component({
@@ -12,25 +14,59 @@
 
   user: UserDto;
-  myForm: FormGroup;
+  form: FormGroup;
+  usernames: string[];
 
-  constructor(private ref: DynamicDialogRef, private fb: FormBuilder) {
+
+  constructor(private ref: DynamicDialogRef, 
+    formBuilder: FormBuilder, private userService: UserService) {
     this.user = new UserDto();
-    this.myForm = fb.group({
-      title: fb.control('initial value', Validators.required)
+    this.usernames = [];
+
+    this.form = formBuilder.group({
+      fullName: new FormControl('', [Validators.required, Validators.minLength(3)]),
+      username: new FormControl('', [Validators.required, Validators.email]),
+      password: new FormControl('', [Validators.required, Validators.minLength(6)]),
+      confirmPassword: new FormControl('', [Validators.required, Validators.minLength(6)])
+    }, {
+      validators: [
+        CustomValidators.mustMatch('password', 'confirmPassword'),
+        this.validateUsername('username')
+      ]
     });
   }
 
   ngOnInit(): void {
-    this.myForm = this.fb.group({
-      fullName: this.fb.control('', Validators.required),
-      username: this.fb.control('', Validators.required),
-      password: this.fb.control('', Validators.required),
-      confirmPassword: this.fb.control('', Validators.required)
-    });
   }
 
   onFormSubmitSignUp(user) {
-    this.ref.close(user);
-    //window.location.reload();
+    const { valid } = this.form;
+    if (valid) {
+      this.ref.close(user);
+    }
+  }
+
+  validateUsername(username: string) {
+    return (formGroup: FormGroup) => {
+      const control = formGroup.controls[username];
+
+      if (control.errors && !control.errors.validateUsername) {
+        return;
+      }
+
+      this.userService.getAllUsernames().subscribe(
+        data => {
+          this.usernames = data;
+          for (let i = 0; i < this.usernames.length; i++) {
+            if (control.value === this.usernames[i]) {
+              control.setErrors({ validateUsername: true });
+              break;
+            } else {
+              control.setErrors(null);
+            }
+          }
+        }
+      );
+      return null;
+    };
 
   }
