aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/user-login
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-03-04 16:30:44 +0800
committercrupest <crupest@outlook.com>2019-03-04 16:30:44 +0800
commit0231d74f07d6b7908ec4728d58057688f0a73c0f (patch)
tree03504a1e866d1f5520688e02a1296d7c8e94fdf9 /Timeline/ClientApp/src/app/user-login
parentd55648859a53dce157939d96a20bd5725b3a1fae (diff)
downloadtimeline-0231d74f07d6b7908ec4728d58057688f0a73c0f.tar.gz
timeline-0231d74f07d6b7908ec4728d58057688f0a73c0f.tar.bz2
timeline-0231d74f07d6b7908ec4728d58057688f0a73c0f.zip
Develop some basic parts of auth.
Diffstat (limited to 'Timeline/ClientApp/src/app/user-login')
-rw-r--r--Timeline/ClientApp/src/app/user-login/user-login.component.css12
-rw-r--r--Timeline/ClientApp/src/app/user-login/user-login.component.html13
-rw-r--r--Timeline/ClientApp/src/app/user-login/user-login.component.spec.ts25
-rw-r--r--Timeline/ClientApp/src/app/user-login/user-login.component.ts27
4 files changed, 77 insertions, 0 deletions
diff --git a/Timeline/ClientApp/src/app/user-login/user-login.component.css b/Timeline/ClientApp/src/app/user-login/user-login.component.css
new file mode 100644
index 00000000..4cdd865f
--- /dev/null
+++ b/Timeline/ClientApp/src/app/user-login/user-login.component.css
@@ -0,0 +1,12 @@
+form {
+ display: flex;
+ flex-wrap: wrap;
+}
+
+div.w-100 {
+ width: 100%;
+}
+
+.login-button {
+ margin-left: auto;
+}
diff --git a/Timeline/ClientApp/src/app/user-login/user-login.component.html b/Timeline/ClientApp/src/app/user-login/user-login.component.html
new file mode 100644
index 00000000..6fed6bb5
--- /dev/null
+++ b/Timeline/ClientApp/src/app/user-login/user-login.component.html
@@ -0,0 +1,13 @@
+<form [formGroup]="form">
+ <mat-form-field>
+ <mat-label>Username</mat-label>
+ <input formControlName="username" matInput type="text" />
+ </mat-form-field>
+ <div class="w-100"></div>
+ <mat-form-field>
+ <mat-label>Password</mat-label>
+ <input formControlName="password" matInput type="password" />
+ </mat-form-field>
+ <div class="w-100"></div>
+ <button mat-flat-button class="login-button" (appDebounceClick)="onLoginButtonClick()">Login</button>
+</form>
diff --git a/Timeline/ClientApp/src/app/user-login/user-login.component.spec.ts b/Timeline/ClientApp/src/app/user-login/user-login.component.spec.ts
new file mode 100644
index 00000000..b606b7b4
--- /dev/null
+++ b/Timeline/ClientApp/src/app/user-login/user-login.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { UserLoginComponent } from './user-login.component';
+
+describe('UserLoginComponent', () => {
+ let component: UserLoginComponent;
+ let fixture: ComponentFixture<UserLoginComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ UserLoginComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(UserLoginComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/Timeline/ClientApp/src/app/user-login/user-login.component.ts b/Timeline/ClientApp/src/app/user-login/user-login.component.ts
new file mode 100644
index 00000000..072f04af
--- /dev/null
+++ b/Timeline/ClientApp/src/app/user-login/user-login.component.ts
@@ -0,0 +1,27 @@
+import { Component, Output, OnInit, EventEmitter } from '@angular/core';
+import { FormGroup, FormControl } from '@angular/forms';
+
+export class LoginEvent {
+ username: string;
+ password: string;
+}
+
+@Component({
+ selector: 'app-user-login',
+ templateUrl: './user-login.component.html',
+ styleUrls: ['./user-login.component.css']
+})
+export class UserLoginComponent {
+
+ @Output()
+ login = new EventEmitter<LoginEvent>();
+
+ form = new FormGroup({
+ username: new FormControl(''),
+ password: new FormControl('')
+ });
+
+ onLoginButtonClick() {
+ this.login.emit(this.form.value);
+ }
+}