diff options
author | Sonja Galovic <galovicsonja@gmail.com> | 2022-03-05 22:03:03 +0100 |
---|---|---|
committer | Sonja Galovic <galovicsonja@gmail.com> | 2022-03-05 22:03:03 +0100 |
commit | cd2188997ff4cbcce83e3cada3fc220375ebc78e (patch) | |
tree | 3e82fff661cc20c33198c0f330e3f8c733a6e0a4 /frontend/src/app/_pages/login-page/login-page.component.ts | |
parent | 843c57eba8709d1001cf8cae3a0180f865171167 (diff) |
Login and Register page - v. 0.1.0
Diffstat (limited to 'frontend/src/app/_pages/login-page/login-page.component.ts')
-rw-r--r-- | frontend/src/app/_pages/login-page/login-page.component.ts | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/frontend/src/app/_pages/login-page/login-page.component.ts b/frontend/src/app/_pages/login-page/login-page.component.ts new file mode 100644 index 00000000..c041003d --- /dev/null +++ b/frontend/src/app/_pages/login-page/login-page.component.ts @@ -0,0 +1,46 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { AuthService } from 'src/app/_services/auth.service'; +//import { LoginService } from 'src/app/_services/login.service'; + +@Component({ + selector: 'app-login-page', + templateUrl: './login-page.component.html', + styleUrls: ['./login-page.component.css'] +}) +export class LoginPageComponent implements OnInit { + + public pageLoaded: boolean = false; //ako korisnik ne sme da ima pristup stranici (vec je ulogovan itd), ona ne sme ni da se ucita + email: string = ''; + password: string = ''; + + public wrongCreds: boolean = false; //RAZMOTRITI + //public notApproved: boolean = false; //RAZMOTRITI + + pattEmail: RegExp = /^[a-zA-Z0-9]+([\.\-\+][a-zA-Z0-9]+)*\@([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}$/; + + constructor( + private activatedRoute: ActivatedRoute, + private authService: AuthService + //private loginService: LoginService + ) { } + + ngOnInit(): void { + /*this.authService.checkAccess(this.activatedRoute, this, + (self: any) => self.pageLoaded = true; + );*/ + } + + onSubmit() { + //this.wrongCreds = false; + //this.notApproved = false; RAZMOTRITI + + if (this.pattEmail.test(this.email)) { + //this.loginService.login(this.email, this.password); + } + else { + //this.wrongCreds = true; + } + } + +} |