# Login/logout

**URL:** <https://forum.ionicframework.com/t/login-logout/158480>\
**Category:** Ionic Framework\
**Created:** [March 7, 2019, 2:50pm UTC](https://forum.ionicframework.com/t/login-logout/158480 "2019-03-07T14:50:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ImadEL](https://avatars.discourse-cdn.com/v4/letter/i/59ef9b/32.png) [@ImadEL](https://forum.ionicframework.com/u/ImadEL)\
**Post date:** [March 7, 2019, 2:50pm UTC](https://forum.ionicframework.com/t/login-logout/158480/1 "2019-03-07T14:50:58Z")

</div>

hi everybody, im new to this forum but not very very new to ionic, i worked with angular and its very similar,  
my question is that,  
when im logged in and the url is like this =\> [http://localhost/](http://localhost/) =\> then it has to redirect to home ONLY if im logged in.  
if im not logged in and the url is like this =\> [http://localhost/](http://localhost/) =\> then you have go back to the login page, and the side-menu only has to appear when im logged in.

i can’t continue becaus im stuck with this and i dont know what to do, with this project im not using database with this one first i wanna do it without database.

loginpage.ts  
Login(){  
if (this.username == “admin” && this.password == “admin”) {  
this.navCtrl.navigateRoot("/home")  
}else{  
this.ErrorMessage();  
}  
}

loginpage.html  
\<ion-content padding\>

\<ion-item\>

\<ion-label\>Username:\</ion-label\>

\<ion-input [(ngModel)]=“username”\>\</ion-input\>

\<ion-icon name=“person” item-right\>\</ion-icon\>

\</ion-item\>

\<ion-item\>

\<ion-label\>Password:\</ion-label\>

\<ion-input [(ngModel)]=“password” [type]=“passwordType”\>\</ion-input\>

\<ion-icon [name]=“passwordIcon” (click)=“ShowHidden()” item-right\>\</ion-icon\>

\</ion-item\>

\<div\>

\<ion-button expand=“block” (click)=“Login()”\>Login\</ion-button\>

\</div\>

thanks in advance
