1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 22:03:36 +00:00

print folder, collections, and ciphers to vault

This commit is contained in:
Kyle Spearrin
2018-01-23 16:58:32 -05:00
parent 78b1f5df99
commit 881b581fe3
7 changed files with 64 additions and 35 deletions

View File

@@ -1,3 +1,8 @@
<form> <form (ngSubmit)="onSubmit()" #heroForm="ngForm">
Login form. <label for="email">Email Address</label>
<input id="email" type="text" [(ngModel)]="email" name="email" required /><br /><br />
<label for="master-password">Master Password</label>
<input id="master-password" type="password" [(ngModel)]="masterPassword"
name="masterPassword" required /><br /><br />
<button type="submit">Submit</button>
</form> </form>

View File

@@ -5,6 +5,8 @@ import {
OnInit, OnInit,
} from '@angular/core'; } from '@angular/core';
import { Router } from '@angular/router';
import { AuthService } from 'jslib/abstractions/auth.service'; import { AuthService } from 'jslib/abstractions/auth.service';
@Component({ @Component({
@@ -12,11 +14,19 @@ import { AuthService } from 'jslib/abstractions/auth.service';
template: template template: template
}) })
export class LoginComponent implements OnInit { export class LoginComponent implements OnInit {
constructor(authService: AuthService) { email: string = '';
console.log(authService); masterPassword: string = '';
constructor(private authService: AuthService, private router: Router) {
} }
ngOnInit() { ngOnInit() {
// TODO? // TODO?
} }
async onSubmit() {
const response = await this.authService.logIn(this.email, this.masterPassword);
this.router.navigate(['vault']);
}
} }

View File

@@ -3,6 +3,7 @@ import 'zone.js/dist/zone';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { ServicesModule } from './services/services.module'; import { ServicesModule } from './services/services.module';
@@ -13,6 +14,7 @@ import { VaultComponent } from './vault/vault.component';
@NgModule({ @NgModule({
imports: [ imports: [
BrowserModule, BrowserModule,
FormsModule,
AppRoutingModule, AppRoutingModule,
ServicesModule, ServicesModule,
], ],

View File

@@ -1,4 +1,4 @@
//import { remote } from 'electron'; import { webFrame } from 'electron';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
@@ -50,6 +50,8 @@ import {
UtilsService as UtilsServiceAbstraction, UtilsService as UtilsServiceAbstraction,
} from 'jslib/abstractions'; } from 'jslib/abstractions';
webFrame.registerURLSchemeAsPrivileged('file');
const utilsService = new UtilsService(); const utilsService = new UtilsService();
const platformUtilsService = new DesktopPlatformUtilsService(); const platformUtilsService = new DesktopPlatformUtilsService();
const messagingService = new DesktopMessagingService(); const messagingService = new DesktopMessagingService();
@@ -82,11 +84,19 @@ const authService: AuthServiceAbstraction = new AuthService(cryptoService, apiSe
userService, tokenService, appIdService, platformUtilsService, constantsService, userService, tokenService, appIdService, platformUtilsService, constantsService,
messagingService); messagingService);
containerService.attachToWindow(window);
environmentService.setUrlsFromStorage().then(() => {
return syncService.fullSync(true);
});
@NgModule({ @NgModule({
imports: [], imports: [],
declarations: [], declarations: [],
providers: [ providers: [
{ provide: AuthServiceAbstraction, useValue: authService }, { provide: AuthServiceAbstraction, useValue: authService },
{ provide: CipherServiceAbstraction, useValue: cipherService },
{ provide: FolderServiceAbstraction, useValue: folderService },
{ provide: CollectionServiceAbstraction, useValue: collectionService },
], ],
}) })
export class ServicesModule { export class ServicesModule {

View File

@@ -26,13 +26,15 @@
</ul> </ul>
<h2><i class="fa fa-folder"></i> Folders</h2> <h2><i class="fa fa-folder"></i> Folders</h2>
<ul> <ul>
<li><a href="#"><i class="fa fa-fw fa-caret-right"></i> Folder 1</a></li> <li *ngFor="let folder of vaultFolders">
<li><a href="#"><i class="fa fa-fw fa-caret-right"></i> Folder 2</a></li> <a href="#"><i class="fa fa-fw fa-caret-right"></i> {{folder.name}}</a>
</li>
</ul> </ul>
<h2><i class="fa fa-cubes"></i> Collections</h2> <h2><i class="fa fa-cubes"></i> Collections</h2>
<ul> <ul>
<li><a href="#"><i class="fa fa-fw fa-caret-right"></i> Collection 1</a></li> <li *ngFor="let collection of vaultCollections">
<li><a href="#"><i class="fa fa-fw fa-caret-right"></i> Collection 2</a></li> <a href="#"><i class="fa fa-fw fa-caret-right"></i> {{collection.name}}</a>
</li>
</ul> </ul>
</div> </div>
</div> </div>
@@ -49,32 +51,14 @@
<div class="content"> <div class="content">
<div class="list"> <div class="list">
<div class="list-section" style="padding-top: 0; padding-bottom: 0;"> <div class="list-section" style="padding-top: 0; padding-bottom: 0;">
<a href="#" <a *ngFor="let cipher of vaultCiphers"
class="list-section-item condensed" title="View Item"> href="#" class="list-section-item condensed" title="View Item">
<span class="text"> <span class="text">
Item 1 {{cipher.name}}
<i class="fa fa-share-alt text-muted"></i> <i class="fa fa-share-alt text-muted" *ngIf="cipher.organizationId"></i>
<i class="fa fa-paperclip text-muted"></i> <i class="fa fa-paperclip text-muted" *ngIf="cipher.attachments"></i>
</span> </span>
<span class="detail">Sub</span> <span class="detail">{{cipher.subTitle}}</span>
</a>
<a href="#"
class="list-section-item condensed" title="View Item">
<span class="text">
Item 1
<i class="fa fa-share-alt text-muted"></i>
<i class="fa fa-paperclip text-muted"></i>
</span>
<span class="detail">Sub</span>
</a>
<a href="#"
class="list-section-item condensed" title="View Item">
<span class="text">
Item 1
<i class="fa fa-share-alt text-muted"></i>
<i class="fa fa-paperclip text-muted"></i>
</span>
<span class="detail">Sub</span>
</a> </a>
</div> </div>
</div> </div>

View File

@@ -5,12 +5,29 @@ import {
OnInit, OnInit,
} from '@angular/core'; } 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({ @Component({
selector: 'app-vault', selector: 'app-vault',
template: template, template: template,
}) })
export class VaultComponent implements OnInit { 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? // TODO?
this.vaultFolders = await this.folderService.getAllDecrypted();
this.vaultCollections = await this.collectionService.getAllDecrypted();
this.vaultCiphers = await this.cipherService.getAllDecrypted();
} }
} }

View File

@@ -69,7 +69,8 @@ const renderer = {
loader: 'file-loader', loader: 'file-loader',
options: { options: {
name: '[name].[ext]', name: '[name].[ext]',
outputPath: 'fonts/' outputPath: 'fonts/',
publicPath: '../'
} }
}] }]
}, },