Skip to content

Commit 5d30951

Browse files
committed
code cleanup
1 parent 4e1326c commit 5d30951

3 files changed

Lines changed: 14 additions & 84 deletions

File tree

src/pages/login/login.html

Lines changed: 6 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<button ion-button menuToggle>
1010
<ion-icon name="menu"></ion-icon>
1111
</button>
12-
<ion-title>Register</ion-title>
12+
<ion-title>Login</ion-title>
1313
</ion-navbar>
1414
</ion-header>
1515

@@ -19,75 +19,7 @@
1919
<h1 id="title">INTRANSITION</h1>
2020
</div>
2121

22-
<!-- <ion-grid fixed>
23-
24-
<br>
25-
26-
<ion-row>
27-
<ion-col col-1></ion-col>
28-
<ion-col>
29-
<h2 text-center>Transitioning from the military to civilian environment is more than just a job change.</h2>
30-
<br>
31-
<h2 id="lifechange" text-center>It's a life change.</h2>
32-
</ion-col>
33-
<ion-col col-1></ion-col>
34-
</ion-row>
35-
36-
<br>
37-
38-
<ion-row>
39-
<ion-col col-1></ion-col>
40-
<ion-col>
41-
<ion-label class="labels" style="font-size: 25px" stacked>EMAIL ADDRESS</ion-label>
42-
<ion-input [(ngModel)] = "user.email" class="inputs" id="email" type="email"></ion-input>
43-
</ion-col>
44-
<ion-col col-1></ion-col>
45-
</ion-row>
46-
47-
<ion-row>
48-
<ion-col col-1></ion-col>
49-
<ion-col>
50-
<ion-label class="labels" style="font-size: 25px" stacked>PASSWORD</ion-label>
51-
<div>
52-
<ion-input [(ngModel)] = "user.password"class="inputs" id="password" type="password"><button ion-button>Hi</button></ion-input>
53-
</div>
54-
</ion-col>
55-
<ion-col col-1></ion-col>
56-
</ion-row>
57-
58-
<br>
59-
<br>
60-
61-
<ion-row>
62-
<ion-col col-2></ion-col>
63-
<ion-col>
64-
<button (click) = "login()" id="loginbutton" ion-button block>LOGIN</button>
65-
</ion-col>
66-
<ion-col col-2></ion-col>
67-
</ion-row>
68-
69-
<br>
70-
<br>
71-
72-
<ion-row>
73-
<ion-col col-1></ion-col>
74-
<ion-col>
75-
<h3 text-center>If you don't have an account yet, you can register now.</h3>
76-
</ion-col>
77-
<ion-col col-1></ion-col>
78-
</ion-row>
79-
80-
<ion-row style="padding-bottom:30px;">
81-
<ion-col col-2></ion-col>
82-
<ion-col>
83-
<button (click)="toRegisterPage()" id="signupbutton" ion-button block>SIGN UP</button>
84-
</ion-col>
85-
<ion-col col-2></ion-col>
86-
</ion-row>
87-
88-
</ion-grid> -->
89-
90-
<form [formGroup]="loginCreds" (ngSubmit)="logForm()">
22+
<form [formGroup]="loginCreds" (ngSubmit)="login()">
9123
<ion-grid>
9224

9325
<ion-row>
@@ -103,7 +35,7 @@ <h2 id="lifechange" text-center>It's a life change.</h2>
10335
<ion-row>
10436
<ion-col col-1></ion-col>
10537
<ion-col>
106-
<ion-label class="labels" style="font-size: 25px" stacked>EMAIL ADDRESS</ion-label>
38+
<ion-label class="labels" style="font-size: 25px" stacked>EMAIL ADDRESS</ion-label>
10739
<ion-input formControlName="email" class="inputs" id="email" type="email"></ion-input>
10840
</ion-col>
10941
<ion-col col-1></ion-col>
@@ -123,7 +55,7 @@ <h2 id="lifechange" text-center>It's a life change.</h2>
12355
<ion-col col-1></ion-col>
12456
<ion-col>
12557
<ion-label class="labels" style="font-size: 25px" stacked>PASSWORD</ion-label>
126-
<ion-input formControlName="password" class="inputs" id="password" type="password"><button ion-button>Hi</button></ion-input>
58+
<ion-input formControlName="password" class="inputs" id="password" type="password"></ion-input>
12759
</ion-col>
12860
<ion-col col-1></ion-col>
12961
</ion-row>
@@ -141,7 +73,7 @@ <h2 id="lifechange" text-center>It's a life change.</h2>
14173
<ion-row>
14274
<ion-col col-2></ion-col>
14375
<ion-col>
144-
<button (click)="login()" id="loginbutton" type="submit" ion-button block [disabled]="!loginCreds.valid">LOGIN</button>
76+
<button id="loginbutton" type="submit" ion-button block [disabled]="!loginCreds.valid">LOGIN</button>
14577
</ion-col>
14678
<ion-col col-2></ion-col>
14779
</ion-row>
@@ -154,7 +86,7 @@ <h3 text-center>If you don't have an account yet, you can register now.</h3>
15486
<ion-col col-1></ion-col>
15587
</ion-row>
15688

157-
<ion-row style="padding-bottom:30px;">
89+
<ion-row>
15890
<ion-col col-2></ion-col>
15991
<ion-col>
16092
<button (click)="toRegisterPage()" id="signupbutton" ion-button block>SIGN UP</button>

src/pages/login/login.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ page-login {
2525

2626
.labels {
2727
color: rgb(96,96,96);
28-
font-size: 25px;
2928
}
3029

3130
#email:before {
@@ -115,6 +114,8 @@ page-login {
115114

116115
.labels {
117116
padding-left: 15%;
117+
font-size: 25px;
118+
118119
}
119120

120121

src/pages/login/login.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { Component } from '@angular/core';
22
import { NavController, NavParams } from 'ionic-angular';
3-
import {Validators, FormBuilder, FormGroup } from '@angular/forms';
3+
import { Validators, FormBuilder, FormGroup, FormControl } from '@angular/forms';
4+
45
import { RegisterPage } from '../register/register';
6+
import { DashboardPage } from '../dashboard/dashboard';
57

68
import { UserProvider } from '../../providers/user/user'
7-
import { DashboardPage } from '../dashboard/dashboard';
9+
810

911
/**
1012
* Generated class for the LoginPage page.
@@ -19,11 +21,6 @@ import { DashboardPage } from '../dashboard/dashboard';
1921
})
2022
export class LoginPage {
2123

22-
user: any = {
23-
email: '',
24-
password: ''
25-
}
26-
2724
private loginCreds : FormGroup;
2825

2926
constructor(public navCtrl: NavController, public navParams: NavParams, public _userService: UserProvider, private formBuilder: FormBuilder) {
@@ -39,11 +36,11 @@ export class LoginPage {
3936
}
4037

4138
login() {
42-
this._userService.login(this.user)
39+
this._userService.login(this.loginCreds.value)
4340
.subscribe(
4441
(res) => {
4542
alert("you're logged in!")
46-
this.navCtrl.setRoot(DashboardPage);
43+
this.toDashboard();
4744
},
4845
(err) => alert("Invalid credentials")
4946
)

0 commit comments

Comments
 (0)