diff --git a/kibicara-frontend/src/app/auth/register/register.component.html b/kibicara-frontend/src/app/auth/register/register.component.html index 5116afb..ef70752 100644 --- a/kibicara-frontend/src/app/auth/register/register.component.html +++ b/kibicara-frontend/src/app/auth/register/register.component.html @@ -1,56 +1,67 @@ -
{{ error }}
-
{{ info }}
-

Register

-
-
- - -
-
- E-Mail is required -
-
-
-
- - -
-
- Password is required -
-
- Password must be at least 6 characters -
-
-
-
- - Cancel -
-
+
+ + + +

Register as a hood admin!

+
+ +
+
+ + E-Mail + + + E-Mail is required + + + + + Password + + + Password is required + + + Password requires minimal length 8 + + +
+
+ + Cancel +
+
+
+
+
diff --git a/kibicara-frontend/src/app/auth/register/register.component.scss b/kibicara-frontend/src/app/auth/register/register.component.scss index e69de29..cf905bc 100644 --- a/kibicara-frontend/src/app/auth/register/register.component.scss +++ b/kibicara-frontend/src/app/auth/register/register.component.scss @@ -0,0 +1,43 @@ +.input-container { + display: grid; + grid-template-rows: 1fr 1fr; + margin-left: 5%; + margin-right: 5%; + margin-bottom: 5%; + margin-top: 3%; +} + +.mat-card:not([class*="mat-elevation-z"]) { + box-shadow: none; +} + +.container { + display: grid; + grid-template-columns: 1fr 1fr; + margin-left: 10%; + margin-right: 10%; + margin-top: 5%; + @media (max-width: 600px) { + grid-template-columns: 1fr; + margin-top: 10%; + margin-left: 5%; + margin-right: 5%; + } +} + +.banner { + background: url("../../../assets/hoods1.jpg"); + background-size: 100%; + display: block; + width: 100%; + height: 100%; +} + +.buttons { + margin-left: 20px; +} + +.register-form { + margin-top: 10%; + margin-bottom: 10%; +} diff --git a/kibicara-frontend/src/app/auth/register/register.component.ts b/kibicara-frontend/src/app/auth/register/register.component.ts index 57678a4..f9c9aab 100644 --- a/kibicara-frontend/src/app/auth/register/register.component.ts +++ b/kibicara-frontend/src/app/auth/register/register.component.ts @@ -3,6 +3,8 @@ import { AdminService } from '../../core/api'; import { Validators, FormBuilder, FormGroup } from '@angular/forms'; import { first } from 'rxjs/operators'; import { Router, ActivatedRoute } from '@angular/router'; +import { LoginService } from 'src/app/core/auth/login.service'; +import { MatSnackBar } from '@angular/material/snack-bar'; @Component({ selector: 'app-register', @@ -13,23 +15,34 @@ export class RegisterComponent implements OnInit { registerForm: FormGroup; loading = false; submitted = false; - error: string; - info: string; constructor( private readonly adminService: AdminService, private formBuilder: FormBuilder, - private route: ActivatedRoute - ) {} + private route: ActivatedRoute, + private loginService: LoginService, + private router: Router, + private snackBar: MatSnackBar + ) { + if (this.loginService.currentHoodAdminValue) { + this.router.navigate(['/dashboard']); + } + } ngOnInit(): void { this.registerForm = this.formBuilder.group({ email: ['', Validators.required], - password: ['', [Validators.required, Validators.minLength(6)]], + password: ['', [Validators.required, Validators.minLength(8)]], }); if (this.route.snapshot.queryParams['error']) { - this.error = 'Invalid confirmation link. Try registering again'; + this.snackBar.open( + 'Invalid confirmation link. Try registering again', + 'Close', + { + duration: 2000, + } + ); } } @@ -44,12 +57,23 @@ export class RegisterComponent implements OnInit { .pipe(first()) .subscribe( (data) => { - this.info = - 'Registration E-Mail has been sent. Please check your inbox.'; + this.snackBar.open( + 'Registration E-Mail has been sent. Please check your inbox.', + 'Close', + { + duration: 2000, + } + ); this.loading = false; }, (error) => { - this.error = 'Registration failed! E-Mail exists or is not valid.'; + this.snackBar.open( + 'Registration failed! E-Mail exists or is not valid.', + 'Close', + { + duration: 2000, + } + ); this.loading = false; } );