Skip to content

Commit 842e529

Browse files
Flow 1: Simple flow: No email/phone verification
1 parent baab869 commit 842e529

38 files changed

+934
-68
lines changed

angular.json

+10-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,17 @@
2323
"src/assets"
2424
],
2525
"styles": [
26-
"src/styles.css"
26+
"src/styles.css",
27+
"node_modules/bootstrap/dist/css/bootstrap.min.css",
28+
"node_modules/font-awesome/css/font-awesome.min.css"
2729
],
28-
"scripts": []
30+
"scripts": [
31+
"node_modules/bootstrap/dist/js/bootstrap.min.js",
32+
"node_modules/jquery/dist/jquery.min.js",
33+
"node_modules/amazon-cognito-identity-js/dist/amazon-cognito-identity.min.js",
34+
"node_modules/aws-sdk/dist/aws-sdk.min.js"
35+
36+
]
2937
},
3038
"configurations": {
3139
"production": {

package-lock.json

+91-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
"@angular/platform-browser": "^6.1.0",
2121
"@angular/platform-browser-dynamic": "^6.1.0",
2222
"@angular/router": "^6.1.0",
23+
"@ng-bootstrap/ng-bootstrap": "^2.2.2",
24+
"amazon-cognito-identity-js": "^2.0.19",
25+
"aws-sdk": "^2.282.1",
2326
"bootstrap": "^4.1.3",
2427
"core-js": "^2.5.4",
2528
"font-awesome": "^4.7.0",
29+
"jquery": "^3.3.1",
2630
"rxjs": "^6.0.0",
2731
"zone.js": "~0.8.26"
2832
},

src/app/app-routing.module.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule, Routes } from '@angular/router';
3-
import { SignInComponent } from './signin/signin.component';
3+
4+
import { IndexComponent} from './index/index.component';
5+
6+
import { SignInComponent as F1SignInComponent} from './f1/signin/signin.component';
7+
import { SignUpComponent as F1SignUpComponent } from './f1/signup/signup.component';
8+
import { IndexComponent as F1IndexComponent } from './f1/index/index.component';
9+
import { DashboardComponent as F1DashboardComponent} from './f1/dashboard/dashboard.component';
410

511
const routes: Routes = [
6-
{ path: '', redirectTo: '/', pathMatch: 'full' },
7-
{ path: 'signin', component: SignInComponent },
12+
{ path: '', component: IndexComponent },
13+
14+
{ path: 'f1', component: F1IndexComponent },
15+
{ path: 'f1/signin', component: F1SignInComponent },
16+
{ path: 'f1/signup', component: F1SignUpComponent },
17+
{ path: 'f1/dashboard', component: F1DashboardComponent },
818
];
919

1020
@NgModule({

src/app/app.component.html

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
<!--The content below is only a placeholder and can be replaced.-->
2-
<nav>
3-
<a routerLink="/signin">Sign In</a>
4-
</nav>
51
<router-outlet></router-outlet>
62

73

src/app/app.module.ts

+21-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
11
import { BrowserModule } from '@angular/platform-browser';
22
import { NgModule } from '@angular/core';
3-
import { FormsModule } from '@angular/forms';
3+
import { NgbModule} from '@ng-bootstrap/ng-bootstrap';
4+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
45

56
import { AppComponent } from './app.component';
6-
import { SignInComponent } from './signin/signin.component';
7-
import { AppRoutingModule } from './/app-routing.module';
7+
import { IndexComponent } from './index/index.component';
8+
import { AppRoutingModule } from './app-routing.module';
9+
10+
import { IndexComponent as F1IndexComponent} from './f1/index/index.component';
11+
import { SignInComponent as F1SignInComponent } from './f1/signin/signin.component';
12+
import { SignUpComponent as F1SignUpComponent } from './f1/signup/signup.component';
13+
import { HeaderComponent as F1HeaderComponent} from './f1/header/header.component';
14+
import { DashboardComponent as F1DashboardComponent} from './f1/dashboard/dashboard.component';
815

916
@NgModule({
1017
declarations: [
1118
AppComponent,
12-
SignInComponent
19+
F1SignInComponent,
20+
F1SignUpComponent,
21+
IndexComponent,
22+
F1IndexComponent,
23+
F1HeaderComponent,
24+
F1DashboardComponent,
1325
],
1426
imports: [
1527
BrowserModule,
1628
FormsModule,
29+
ReactiveFormsModule,
1730
AppRoutingModule,
31+
NgbModule.forRoot(),
32+
],
33+
providers: [
34+
{ provide: 'location', useValue: location },
1835
],
19-
providers: [],
2036
bootstrap: [AppComponent]
2137
})
2238
export class AppModule { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<app-header></app-header>
2+
<div class="col-md-6 offset-md-3">
3+
<div class="card">
4+
<div class="card-header">Profile</div>
5+
<div class="card-body">
6+
<div class="row">
7+
<div class="col-md-4 pull-right">Name:</div>
8+
<div class="col-md-5">{{profile.name}}</div>
9+
</div>
10+
<div class="row">
11+
<div class="col-md-4 pull-right">Email:</div>
12+
<div class="col-md-5">{{profile.email}}</div>
13+
</div>
14+
<div class="row">
15+
<div class="col-md-4 pull-right">Phone:</div>
16+
<div class="col-md-5">{{profile.phone}}</div>
17+
</div>
18+
</div>
19+
</div>
20+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { DashboardComponent } from './dashboard.component';
4+
5+
describe('DashboardComponent', () => {
6+
let component: DashboardComponent;
7+
let fixture: ComponentFixture<DashboardComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ DashboardComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(DashboardComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Component, OnInit, Inject } from '@angular/core';
2+
import { AuthenticationService } from '../../services/authentication.service';
3+
import { Router } from '../../../../node_modules/@angular/router';
4+
import { Profile } from '../../model/profile';
5+
6+
@Component({
7+
selector: 'app-dashboard',
8+
templateUrl: './dashboard.component.html'
9+
})
10+
export class DashboardComponent implements OnInit {
11+
profile: Profile = {
12+
name: '',
13+
email: '',
14+
phone: ''
15+
}
16+
constructor(
17+
private router: Router,
18+
private authenticationService: AuthenticationService
19+
) { }
20+
21+
ngOnInit() {
22+
this.authenticationService.isAuthenticated().subscribe(result => {
23+
if (!result) {
24+
this.router.navigate(['f1/signin']);
25+
} else {
26+
this.authenticationService.getUserAttributes().subscribe(userAttributes => {
27+
this.profile.email = userAttributes.email;
28+
this.profile.name = userAttributes.name;
29+
this.profile.phone = userAttributes.phone_number;
30+
})
31+
}
32+
});
33+
}
34+
35+
}

0 commit comments

Comments
 (0)