From 881b581fe3e27f49af5f46803eddd8b196846b2a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 23 Jan 2018 16:58:32 -0500 Subject: [PATCH] print folder, collections, and ciphers to vault --- src/app/accounts/login.component.html | 9 ++++-- src/app/accounts/login.component.ts | 14 ++++++++-- src/app/app.module.ts | 2 ++ src/app/services/services.module.ts | 12 +++++++- src/app/vault/vault.component.html | 40 ++++++++------------------- src/app/vault/vault.component.ts | 19 ++++++++++++- webpack.renderer.js | 3 +- 7 files changed, 64 insertions(+), 35 deletions(-) diff --git a/src/app/accounts/login.component.html b/src/app/accounts/login.component.html index 2cc33690..132bc0d0 100644 --- a/src/app/accounts/login.component.html +++ b/src/app/accounts/login.component.html @@ -1,3 +1,8 @@ -
- Login form. + + +

+ +

+
diff --git a/src/app/accounts/login.component.ts b/src/app/accounts/login.component.ts index 55523cbf..70a1683e 100644 --- a/src/app/accounts/login.component.ts +++ b/src/app/accounts/login.component.ts @@ -5,6 +5,8 @@ import { OnInit, } from '@angular/core'; +import { Router } from '@angular/router'; + import { AuthService } from 'jslib/abstractions/auth.service'; @Component({ @@ -12,11 +14,19 @@ import { AuthService } from 'jslib/abstractions/auth.service'; template: template }) export class LoginComponent implements OnInit { - constructor(authService: AuthService) { - console.log(authService); + email: string = ''; + masterPassword: string = ''; + + constructor(private authService: AuthService, private router: Router) { + } ngOnInit() { // TODO? } + + async onSubmit() { + const response = await this.authService.logIn(this.email, this.masterPassword); + this.router.navigate(['vault']); + } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 88a38235..e88960e0 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -3,6 +3,7 @@ import 'zone.js/dist/zone'; import { AppRoutingModule } from './app-routing.module'; import { BrowserModule } from '@angular/platform-browser'; +import { FormsModule } from '@angular/forms'; import { NgModule } from '@angular/core'; import { ServicesModule } from './services/services.module'; @@ -13,6 +14,7 @@ import { VaultComponent } from './vault/vault.component'; @NgModule({ imports: [ BrowserModule, + FormsModule, AppRoutingModule, ServicesModule, ], diff --git a/src/app/services/services.module.ts b/src/app/services/services.module.ts index 5343a8d4..f5f78a68 100644 --- a/src/app/services/services.module.ts +++ b/src/app/services/services.module.ts @@ -1,4 +1,4 @@ -//import { remote } from 'electron'; +import { webFrame } from 'electron'; import { NgModule } from '@angular/core'; @@ -50,6 +50,8 @@ import { UtilsService as UtilsServiceAbstraction, } from 'jslib/abstractions'; +webFrame.registerURLSchemeAsPrivileged('file'); + const utilsService = new UtilsService(); const platformUtilsService = new DesktopPlatformUtilsService(); const messagingService = new DesktopMessagingService(); @@ -82,11 +84,19 @@ const authService: AuthServiceAbstraction = new AuthService(cryptoService, apiSe userService, tokenService, appIdService, platformUtilsService, constantsService, messagingService); +containerService.attachToWindow(window); +environmentService.setUrlsFromStorage().then(() => { + return syncService.fullSync(true); +}); + @NgModule({ imports: [], declarations: [], providers: [ { provide: AuthServiceAbstraction, useValue: authService }, + { provide: CipherServiceAbstraction, useValue: cipherService }, + { provide: FolderServiceAbstraction, useValue: folderService }, + { provide: CollectionServiceAbstraction, useValue: collectionService }, ], }) export class ServicesModule { diff --git a/src/app/vault/vault.component.html b/src/app/vault/vault.component.html index 4f7866b8..116cfe9e 100644 --- a/src/app/vault/vault.component.html +++ b/src/app/vault/vault.component.html @@ -26,13 +26,15 @@

Folders

Collections

@@ -49,32 +51,14 @@
diff --git a/src/app/vault/vault.component.ts b/src/app/vault/vault.component.ts index ea461c75..fa2006ae 100644 --- a/src/app/vault/vault.component.ts +++ b/src/app/vault/vault.component.ts @@ -5,12 +5,29 @@ import { OnInit, } from '@angular/core'; +import { CipherService } from 'jslib/abstractions/cipher.service'; +import { CollectionService } from 'jslib/abstractions/collection.service'; +import { FolderService } from 'jslib/abstractions/folder.service'; + @Component({ selector: 'app-vault', template: template, }) export class VaultComponent implements OnInit { - ngOnInit() { + vaultFolders: any[]; + vaultCiphers: any[]; + vaultCollections: any[]; + + constructor(private cipherService: CipherService, private collectionService: CollectionService, + private folderService: FolderService) { + + } + + async ngOnInit() { // TODO? + + this.vaultFolders = await this.folderService.getAllDecrypted(); + this.vaultCollections = await this.collectionService.getAllDecrypted(); + this.vaultCiphers = await this.cipherService.getAllDecrypted(); } } diff --git a/webpack.renderer.js b/webpack.renderer.js index 1bc81b27..ca05d41e 100644 --- a/webpack.renderer.js +++ b/webpack.renderer.js @@ -69,7 +69,8 @@ const renderer = { loader: 'file-loader', options: { name: '[name].[ext]', - outputPath: 'fonts/' + outputPath: 'fonts/', + publicPath: '../' } }] },