From 69efc22a504f1a34075d40ea1f0211067281f4fb Mon Sep 17 00:00:00 2001 From: Gowrisankar J g <59323@hexaware.com> Date: Wed, 22 Sep 2021 00:45:44 +0530 Subject: [PATCH] UI Update --- .../src/app/auth/login/login.component.css | 13 +++- .../src/app/auth/login/login.component.html | 73 ++++++++----------- .../src/app/auth/login/login.component.ts | 49 ++++++------- 3 files changed, 66 insertions(+), 69 deletions(-) diff --git a/Angular-UrbanBazaar/src/app/auth/login/login.component.css b/Angular-UrbanBazaar/src/app/auth/login/login.component.css index b8eeae3..f66ed42 100644 --- a/Angular-UrbanBazaar/src/app/auth/login/login.component.css +++ b/Angular-UrbanBazaar/src/app/auth/login/login.component.css @@ -3,10 +3,19 @@ body { padding: 10px 10px 10px 10px; } -.login-main{ +.login-main { margin-top: 10%; } -mat-card{ + +mat-card { min-width: 30%; max-width: 50%; +} + +.main-div { + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + text-align: center; } \ No newline at end of file diff --git a/Angular-UrbanBazaar/src/app/auth/login/login.component.html b/Angular-UrbanBazaar/src/app/auth/login/login.component.html index 37bef85..c50c8ca 100644 --- a/Angular-UrbanBazaar/src/app/auth/login/login.component.html +++ b/Angular-UrbanBazaar/src/app/auth/login/login.component.html @@ -1,43 +1,34 @@ -
- -                -

-            Welcome to Urban Bazaar !!! -

-
Logo
- - - Login Page - - - - - - - - - - - - -

OR  

- -
-
- - \ No newline at end of file +
+ Logo +
+ + + + + + + + + {{errorMessage}} + + Forgotten password? + + + + + + + +
+ \ No newline at end of file diff --git a/Angular-UrbanBazaar/src/app/auth/login/login.component.ts b/Angular-UrbanBazaar/src/app/auth/login/login.component.ts index 371acab..15838b1 100644 --- a/Angular-UrbanBazaar/src/app/auth/login/login.component.ts +++ b/Angular-UrbanBazaar/src/app/auth/login/login.component.ts @@ -10,41 +10,38 @@ import { UserService } from 'src/app/services/user.service'; @Component({ selector: 'app-login', templateUrl: './login.component.html', - styleUrls: ['./login.component.css'] + styleUrls: ['./login.component.css'], }) export class LoginComponent implements OnInit { username = new FormControl(); password = new FormControl(); - responseMessage : string = ""; - temp : Observable; - // temp : User; - // temps : Observable; - // userList : Observable; -signup(){ - this.router.navigateByUrl('/signup') -} - constructor(private _userService : UserService, private router : Router) {} + responseMessage: string = ''; + temp: Observable; + errorMessage: string = ''; + + constructor(private _userService: UserService, private router: Router) {} + + signup() { + this.router.navigateByUrl('/signup'); + } userLogin() { - // alert(this.username.value+" | "+this.password.value); - let user : Login = { + let user: Login = { userfirstname: this.username.value, - userpassword: this.password.value - } + userpassword: this.password.value, + }; this.temp = this._userService.findUserByUsername(this.username.value); - this.temp.subscribe(v => { - if(v.userpassword == this.password.value) - { this.temp.subscribe(v => this._userService.currentUser = v); - this.router.navigateByUrl('/home'); - alert("Login Successfull !!")} - else - alert("Login falied !!"); + this.temp.subscribe((v) => { + if (v.userpassword == this.password.value) { + this.temp.subscribe((v) => (this._userService.currentUser = v)); + this.router.navigateByUrl('/home'); + alert('Login Successfull !!'); + } else { + this.errorMessage = 'Wrong Password.'; + alert('Login falied !!'); + } }); - - - } - - ngOnInit(): void { } + ngOnInit(): void {} }