Move files around

This commit is contained in:
aditya.chandel
2025-03-11 13:50:59 -06:00
parent 8c33befc51
commit ef1dc6444b
8 changed files with 7 additions and 8 deletions
@@ -0,0 +1,28 @@
<div class="login-container">
<div class="login-wrapper">
<h1 class="app-title">BookLore</h1>
<p-card class="login-card p-fluid">
<ng-template pTemplate="title">Login</ng-template>
<ng-template pTemplate="content">
<form #loginForm="ngForm">
<div class="p-field">
<label for="username">Username</label>
<input pInputText id="username" [(ngModel)]="username" name="username" required fluid/>
</div>
<div class="p-field">
<label for="password">Password</label>
<p-password id="password" [(ngModel)]="password" name="password" [feedback]="false" fluid required></p-password>
</div>
<div class="p-mt-3">
<p-button label="Login" icon="pi pi-sign-in" (click)="login()" class="p-fluid"></p-button>
</div>
<p-message *ngIf="errorMessage" severity="error" text="{{ errorMessage }}"></p-message>
</form>
</ng-template>
</p-card>
</div>
</div>
@@ -0,0 +1,28 @@
.login-container {
@apply flex items-center justify-center min-h-screen bg-gradient-to-br from-blue-900 via-cyan-600 to-blue-400 relative;
}
.login-wrapper {
@apply flex flex-col items-center gap-6 absolute top-1/4 transform -translate-y-1/4;
}
.app-title {
@apply text-5xl font-extrabold text-white drop-shadow-lg;
text-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
}
.login-card {
@apply w-96 shadow-lg rounded-xl bg-opacity-90 backdrop-blur-lg;
}
form {
@apply flex flex-col gap-4;
}
.p-field {
@apply flex flex-col gap-2;
}
p-button {
@apply mt-4;
}
@@ -0,0 +1,45 @@
import { Component } from '@angular/core';
import {AuthService} from '../../service/auth.service';
import {Router} from '@angular/router';
import {FormsModule} from '@angular/forms';
import {NgIf} from '@angular/common';
import {Card} from 'primeng/card';
import {Password} from 'primeng/password';
import {Button} from 'primeng/button';
import {Message} from 'primeng/message';
import {PrimeTemplate} from 'primeng/api';
import {InputText} from 'primeng/inputtext';
@Component({
selector: 'app-login',
imports: [
FormsModule,
NgIf,
Card,
Password,
Button,
Message,
PrimeTemplate,
InputText
],
templateUrl: './login.component.html',
styleUrl: './login.component.scss'
})
export class LoginComponent {
username = '';
password = '';
errorMessage = '';
constructor(private authService: AuthService, private router: Router) {}
login(): void {
this.authService.login({ username: this.username, password: this.password }).subscribe({
next: () => {
this.router.navigate(['/dashboard']);
},
error: () => {
this.errorMessage = 'Invalid username or password';
}
});
}
}