diff options
author | Ognjen Cirkovic <ciraboxkg@gmail.com> | 2022-03-22 15:04:36 +0000 |
---|---|---|
committer | Ognjen Cirkovic <ciraboxkg@gmail.com> | 2022-03-22 15:04:36 +0000 |
commit | 012fb19a54f4d55a6e4cc73227f738f64539cf04 (patch) | |
tree | 57b3de84ad41037e8c7b1403dba4a5bad24a4752 /frontend/src/app/_modals/login-modal | |
parent | b4f0cd025a86c68a5c35a58e62c22b7cedf3d8b5 (diff) | |
parent | 31642f68564e67175301235546b74baf56ac5882 (diff) |
Merge branch 'dev' into 'Privremeno-cuvanje-podataka'
# Conflicts:
# backend/api/api/Controllers/ModelController.cs
Diffstat (limited to 'frontend/src/app/_modals/login-modal')
-rw-r--r-- | frontend/src/app/_modals/login-modal/login-modal.component.html | 10 | ||||
-rw-r--r-- | frontend/src/app/_modals/login-modal/login-modal.component.ts | 23 |
2 files changed, 21 insertions, 12 deletions
diff --git a/frontend/src/app/_modals/login-modal/login-modal.component.html b/frontend/src/app/_modals/login-modal/login-modal.component.html index d694ea58..d7836848 100644 --- a/frontend/src/app/_modals/login-modal/login-modal.component.html +++ b/frontend/src/app/_modals/login-modal/login-modal.component.html @@ -20,12 +20,12 @@ <input [(ngModel)]="password" name="password" type="password" id="password" class="form-control form-control" placeholder="Unesite lozinku..." /> </div> - - <div class="text-center text-lg-start mt-5 pt-2"> - <p *ngIf="wrongCreds" class="small fw-bold mt-2 pt-1 mb-0 text-danger">Lozinka ili e-mail su pogrešni - </p> - </div> </form> + + <div class="text-center text-lg-start mt-5"> + <p *ngIf="wrongCreds" class="small fw-bold text-danger text-center">Unesite ispravan e-mail i lozinku.</p> + </div> + <div class="col-md-12 d-flex justify-content-center"> <button type="button" class="btn btn-lg" style="color:white; background-color: #003459; margin-right: 10px;" (click)="doLogin()">Prijavite se</button> <button type="button" class="btn btn-lg btn-outline-secondary" data-bs-dismiss="modal" (click)="resetData()">Odustanite</button> diff --git a/frontend/src/app/_modals/login-modal/login-modal.component.ts b/frontend/src/app/_modals/login-modal/login-modal.component.ts index d17d7017..1b634c9a 100644 --- a/frontend/src/app/_modals/login-modal/login-modal.component.ts +++ b/frontend/src/app/_modals/login-modal/login-modal.component.ts @@ -13,7 +13,7 @@ export class LoginModalComponent implements OnInit { username: string = ''; password: string = ''; - public wrongCreds: boolean = false; //RAZMOTRITI + wrongCreds: boolean = false; constructor( private authService: AuthService, @@ -26,17 +26,26 @@ export class LoginModalComponent implements OnInit { doLogin() { if (this.username.length > 0 && this.password.length > 0) { - this.authService.login(this.username, this.password).subscribe((response) => { //ako nisu ok podaci, ne ide hide nego mora opet da ukucava!!!!podesi + this.authService.login(this.username, this.password).subscribe((response) => { console.log(response); - this.authService.authenticate(response); - (<HTMLSelectElement>document.getElementById('closeButton')).click(); - }, error => { - console.warn(error); //NETACNI PODACI + + if (response == "Username doesn't exist" || response == "Wrong password") { + this.wrongCreds = true; + this.password = ''; + } + else { + this.authService.authenticate(response); + (<HTMLSelectElement>document.getElementById('closeButton')).click(); + } }); } - + else { + this.wrongCreds = true; + this.password = ''; + } } resetData() { + this.wrongCreds = false; this.username = ''; this.password = ''; } |