diff options
Diffstat (limited to 'frontend/src/app/_pages')
-rw-r--r-- | frontend/src/app/_pages/login-page/login-page.component.html | 33 | ||||
-rw-r--r-- | frontend/src/app/_pages/login-page/login-page.component.ts | 41 |
2 files changed, 52 insertions, 22 deletions
diff --git a/frontend/src/app/_pages/login-page/login-page.component.html b/frontend/src/app/_pages/login-page/login-page.component.html index 76a4ee7b..8deb5290 100644 --- a/frontend/src/app/_pages/login-page/login-page.component.html +++ b/frontend/src/app/_pages/login-page/login-page.component.html @@ -1,19 +1,33 @@ +<!--<script> + $(document).ready(function(){ + $(".btn").click(function(){ + $("#exampleModal").modal('show'); + }); + + $('#exampleModal').modal({ + backdrop: 'static', + keyboard: false + }); + }); +</script>--> + +<!-- Button trigger modal --> +<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modalForLogin" (click)="openModal()"> + Open Modal + </button> + +<!-- <div style="min-height: 100vh; position: relative;"> - <!-- TODO : <app-navbar [activeNav]="'login'"></app-navbar>--> - <div class="container p-5 rounded-3 shadow-sm border" style="max-width: 50em; margin-top: 50px;"> <h3 class="text-center pb-5">Prijavite se</h3> <form> - <!-- Username input --> - <!-- Username input --> <div class="form-outline mb-4"> <label class="form-label" for="username">Korisničko ime</label> <input [(ngModel)]="username" name="username" type="text" id="username" class="form-control form-control-lg" placeholder="Unesite korisničko ime..." /> </div> - <!-- Password input --> <div class="form-outline mb-3"> <label class="form-label" for="password">Lozinka</label> <input [(ngModel)]="password" name="password" type="password" id="password" @@ -21,17 +35,15 @@ </div> <div class="text-center text-lg-start mt-4 pt-2"> - <!-- Pogresna lozinka --> <p *ngIf="wrongCreds" class="small fw-bold mt-2 pt-1 mb-0 text-danger">Lozinka ili e-mail su pogrešni </p> - <!-- Nepotvrdjena registracija - <p *ngIf="notApproved" class="small fw-bold mt-2 pt-1 mb-0 text-danger">Vaša registracija još uvek nije potvrđena</p>--> <br> <button type="button" class="btn btn-primary btn-lg" style="padding-left: 2.5rem; padding-right: 2.5rem;" (click)="onSubmit()">Prijava </button> + <br> <p class="small fw-bold mt-2 pt-1 mb-0">Još uvek nemate nalog? <a routerLink="/register" class="link-danger">Registrujte se</a> </p> @@ -39,6 +51,5 @@ </form> </div> - <!-- TODO: <app-footer></app-footer>--> - -</div>
\ No newline at end of file +</div> +-->
\ No newline at end of file diff --git a/frontend/src/app/_pages/login-page/login-page.component.ts b/frontend/src/app/_pages/login-page/login-page.component.ts index 0825d435..e5366283 100644 --- a/frontend/src/app/_pages/login-page/login-page.component.ts +++ b/frontend/src/app/_pages/login-page/login-page.component.ts @@ -3,12 +3,22 @@ import { Router } from '@angular/router'; import { CookieService } from 'ngx-cookie-service'; import { AuthService } from 'src/app/_services/auth.service'; +import { LoginModalComponent } from 'src/app/_modals/login-modal/login-modal.component'; +import { MDBModalRef, MDBModalService } from 'ng-uikit-pro-standard'; + + +declare var window: any; + @Component({ selector: 'app-login-page', templateUrl: './login-page.component.html', - styleUrls: ['./login-page.component.css'] + styleUrls: ['./login-page.component.css'], + }) -export class LoginPageComponent implements OnInit { +export class LoginPageComponent{ + + modalRef?: MDBModalRef; + //email: string = ''; username: string = ''; password: string = ''; @@ -16,29 +26,38 @@ export class LoginPageComponent implements OnInit { 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,}$/; + formModal: any; constructor( private authService: AuthService, private cookie: CookieService, - private router: Router + private router: Router, + private modalService: MDBModalService ) { } + openModal() { + //this.modalRef = this.modalService.show(LoginModalComponent); + } + /* ngOnInit(): void { + this.formModal = new window.bootstrap.Modal( + document.getElementById("exampleModal") + ); + } + + openModal() { + this.formModal.show(); + //console.log("ok"); + //(<HTMLInputElement>document.getElementById("exampleModal")).style.display = "block"; } onSubmit() { - /*if (!this.pattEmail.test(this.email)) { - console.warn('Bad email!'); - return; - } - else {*/ + this.authService.login(this.username, this.password).subscribe((response) => { console.log(response); this.cookie.set('token', response); this.router.navigate(['add-model']); - // }) }); } - +*/ } |