Skip to content
Snippets Groups Projects
Commit 96352b96 authored by David Noah Donges's avatar David Noah Donges
Browse files

Merge branch '65-login-screen-page' into 'master'

Resolve "login screen - page"

Closes #65

See merge request swtp-block-ws17/arsnova-angular-frontend!18
parents 4688ece5 2e83a93f
Branches
Tags
No related merge requests found
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { PageNotFoundComponent } from './page-not-found/page-not-found.component'; import { PageNotFoundComponent } from './page-not-found/page-not-found.component';
import { LoginScreenComponent } from './login-screen/login-screen.component';
const routes: Routes = [ const routes: Routes = [
{ path: 'errorpage', component: PageNotFoundComponent } { path: 'errorpage', component: PageNotFoundComponent },
{ path: 'home', component: LoginScreenComponent },
{ path: '', redirectTo: '/home', pathMatch: 'full' }
]; ];
...@@ -17,4 +19,5 @@ const routes: Routes = [ ...@@ -17,4 +19,5 @@ const routes: Routes = [
], ],
declarations: [] declarations: []
}) })
export class AppRoutingModule { } export class AppRoutingModule {
}
...@@ -44,16 +44,22 @@ import { ...@@ -44,16 +44,22 @@ import {
MatToolbarModule, MatToolbarModule,
MatTooltipModule MatTooltipModule
} from '@angular/material'; } from '@angular/material';
import { LoginScreenComponent } from './login-screen/login-screen.component';
import { NotificationService } from './notification.service'; import { NotificationService } from './notification.service';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
LoginComponent, LoginComponent,
LoginScreenComponent,
PageNotFoundComponent, PageNotFoundComponent,
PasswordResetComponent, PasswordResetComponent,
RegisterComponent RegisterComponent
], ],
entryComponents: [
RegisterComponent,
PasswordResetComponent
],
imports: [ imports: [
AppRoutingModule, AppRoutingModule,
BrowserModule, BrowserModule,
......
<div fxLayout="column" fxLayoutGap="20px">
<div fxLayout="row">
<app-login></app-login>
</div>
<div fxLayout="row" fxLayoutGap="5px">
<button mat-raised-button color="primary" (click)="openRegisterDialog()">Register</button>
<button mat-raised-button color="primary" (click)="openPasswordDialog()">Password reset</button>
</div>
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginScreenComponent } from './login-screen.component';
describe('LoginScreenComponent', () => {
let component: LoginScreenComponent;
let fixture: ComponentFixture<LoginScreenComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoginScreenComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LoginScreenComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material';
import { RegisterComponent } from '../register/register.component';
import { PasswordResetComponent } from '../password-reset/password-reset.component';
@Component({
selector: 'app-login-screen',
templateUrl: './login-screen.component.html',
styleUrls: ['./login-screen.component.scss']
})
export class LoginScreenComponent implements OnInit {
constructor(public dialog: MatDialog) {
}
openRegisterDialog(): void {
this.dialog.open(RegisterComponent, {
width: '350px'
});
}
openPasswordDialog(): void {
this.dialog.open(PasswordResetComponent, {
width: '350px'
});
}
ngOnInit() {
}
}
<form> <form>
<mat-form-field class="input-block"> <mat-form-field class="input-block">
<input matInput #email maxlength="256" placeholder="e-mail"> <input matInput #email maxlength="256" placeholder="E-mail">
<mat-hint align="start"><strong></strong></mat-hint> <mat-hint align="start"><strong></strong></mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field class="input-block"> <mat-form-field class="input-block">
<input matInput type="password" #passwd maxlength="256" placeholder="password"> <input matInput type="password" #passwd maxlength="256" placeholder="Password">
<mat-hint align="start"><strong></strong></mat-hint> <mat-hint align="start"><strong></strong></mat-hint>
<mat-hint align="end">{{passwd.value.length}} / 12</mat-hint> <mat-hint align="end">{{passwd.value.length}} / 256</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field class="input-block"> <mat-form-field class="input-block">
<input matInput type="password" #passwd2 maxlength="256" placeholder="verify password"> <input matInput type="password" #passwd2 maxlength="256" placeholder="Verify password">
<mat-hint align="start"><strong></strong></mat-hint> <mat-hint align="start"><strong></strong></mat-hint>
<mat-hint align="end">{{passwd2.value.length}} / 12</mat-hint> <mat-hint align="end">{{passwd2.value.length}} / 256</mat-hint>
</mat-form-field> </mat-form-field>
<div *ngIf="passwd.value === passwd2.value && passwd.value.length !== 0"> <div *ngIf="passwd.value === passwd2.value && passwd.value.length !== 0">
<mat-icon>check_circle</mat-icon> <mat-icon>check_circle</mat-icon>
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
<mat-icon>clear</mat-icon> <mat-icon>clear</mat-icon>
</div> </div>
<button mat-raised-button color="primary">back</button> <button mat-raised-button color="primary" (click)="save(email.value, passwd.value, passwd2.value)">Register</button>
<button mat-raised-button color="primary" (click)="save(email.value, passwd.value, passwd2.value)">save</button>
</form> </form>
import { Component, OnInit } from '@angular/core'; import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
@Component({ @Component({
selector: 'app-register', selector: 'app-register',
...@@ -8,7 +9,12 @@ import { Component, OnInit } from '@angular/core'; ...@@ -8,7 +9,12 @@ import { Component, OnInit } from '@angular/core';
export class RegisterComponent implements OnInit { export class RegisterComponent implements OnInit {
check = 0; check = 0;
constructor() { constructor(public dialogRef: MatDialogRef<RegisterComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
}
onNoClick(): void {
this.dialogRef.close();
} }
ngOnInit() { ngOnInit() {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment