Skip to content
This repository has been archived by the owner on Jun 4, 2018. It is now read-only.

Commit

Permalink
Added a new password function, also started edit password
Browse files Browse the repository at this point in the history
  • Loading branch information
liz3 committed Jun 4, 2017
1 parent 7f8b1a9 commit b6d3b59
Show file tree
Hide file tree
Showing 11 changed files with 312 additions and 110 deletions.
131 changes: 66 additions & 65 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,67 +1,68 @@
{
"name": "mynewapp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
"name": "mynewapp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.1.2",
"@angular/compiler": "4.1.2",
"@angular/compiler-cli": "4.1.2",
"@angular/core": "4.1.2",
"@angular/forms": "4.1.2",
"@angular/http": "4.1.2",
"@angular/platform-browser": "4.1.2",
"@angular/platform-browser-dynamic": "4.1.2",
"@ionic-native/clipboard": "^3.12.1",
"@ionic-native/core": "3.10.2",
"@ionic-native/http": "^3.11.0",
"@ionic-native/splash-screen": "3.10.2",
"@ionic-native/status-bar": "3.10.2",
"@ionic/storage": "2.0.1",
"cordova-android": "^6.2.3",
"cordova-ios": "^4.4.0",
"cordova-plugin-compat": "^1.1.0",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-file": "^4.3.3",
"cordova-plugin-http": "^1.2.0",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"ionic-angular": "3.3.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.11"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.7",
"@ionic/cli-plugin-cordova": "1.3.0",
"@ionic/cli-plugin-ionic-angular": "1.3.0",
"typescript": "2.3.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-http": {},
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {}
},
"dependencies": {
"@angular/common": "4.1.2",
"@angular/compiler": "4.1.2",
"@angular/compiler-cli": "4.1.2",
"@angular/core": "4.1.2",
"@angular/forms": "4.1.2",
"@angular/http": "4.1.2",
"@angular/platform-browser": "4.1.2",
"@angular/platform-browser-dynamic": "4.1.2",
"@ionic-native/core": "3.10.2",
"@ionic-native/http": "^3.11.0",
"@ionic-native/splash-screen": "3.10.2",
"@ionic-native/status-bar": "3.10.2",
"@ionic/storage": "2.0.1",
"cordova-android": "^6.2.3",
"cordova-ios": "^4.4.0",
"cordova-plugin-compat": "^1.1.0",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-file": "^4.3.3",
"cordova-plugin-http": "^1.2.0",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"ionic-angular": "3.3.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.11"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.7",
"@ionic/cli-plugin-cordova": "1.3.0",
"@ionic/cli-plugin-ionic-angular": "1.3.0",
"typescript": "2.3.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-http": {},
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {}
},
"platforms": [
"android",
"ios"
]
}
}
"platforms": [
"android",
"ios"
]
}
}
18 changes: 18 additions & 0 deletions src/app/Passy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ export class Passy {
return response;
}

public addPassword(http:Http, username, password, description, callback) {

const data = [{name: "a", value: "password/create"},
{ name: "access_token", value: this.accessToken},
{name: "username", value: username}, {name: "password", value: password}, {name: "description", value: description}];

const me = this;
this.request(http, data, function (response) {

const json = JSON.parse(response.text());
if(json.success) {
me.fetchPasswords(http);
}
callback(json);
});

}

public tryLogin(name: string, pass: string, http: Http, callBack){

if (this.loggedIn) return;
Expand Down
79 changes: 43 additions & 36 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,51 @@
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
import {NgModule, ErrorHandler} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {IonicApp, IonicModule, IonicErrorHandler} from 'ionic-angular';
import {MyApp} from './app.component';
import {HomePage} from '../pages/home/home';
import {TabsPage} from '../pages/tabs/tabs';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import {StatusBar} from '@ionic-native/status-bar';
import {SplashScreen} from '@ionic-native/splash-screen';
import {HttpModule} from "@angular/http";
import {LoginPage} from "../pages/login/LoginPage";
import {PassShow} from "../pages/pass-show/pass-show";
import {NewPassPage} from "../pages/new-password/new-pass";
import {EditPassPage} from "../pages/edit-password/edit-pass";

@NgModule({
declarations: [
MyApp,
//HERE
HomePage,
TabsPage,
LoginPage,
PassShow
declarations: [
MyApp,
//HERE
HomePage,
TabsPage,
LoginPage,
PassShow,
NewPassPage,
EditPassPage,

],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
HttpModule
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
//HERE
HomePage,
TabsPage,
LoginPage,
PassShow
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
HttpModule
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
//HERE
HomePage,
TabsPage,
LoginPage,
PassShow,
NewPassPage,
EditPassPage,
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
export class AppModule {
}
21 changes: 21 additions & 0 deletions src/pages/edit-password/edit-pass.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<ion-content>
<ion-list>

<ion-item>
<ion-label floating>Username</ion-label>
<ion-input [(ngModel)]="username" type="text" value=""></ion-input>
</ion-item>

<ion-item>
<ion-label floating>Password</ion-label>
<ion-input [(ngModel)]="password" type="password"></ion-input>
</ion-item>
<ion-item>
<ion-label floating>Description</ion-label>
<ion-input [(ngModel)]="description" type="text"></ion-input>
</ion-item>
</ion-list>
<div padding>
<button ion-button (click)="save()">Save</button>
</div>
</ion-content>
38 changes: 38 additions & 0 deletions src/pages/edit-password/edit-pass.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {Component} from "@angular/core";
import {Http} from "@angular/http";
import {passy} from "../../app/app.component";
import {ViewController} from "ionic-angular";
@Component({
selector: 'new-pass',
templateUrl: 'edit-pass.html'
})

export class EditPassPage {

private username;
private password;
private description;

constructor(public viewCtrl: ViewController,public http:Http) {



}
save() {

const me = this;

passy.addPassword(this.http, this.username, this.password, this.description, function (data) {

if(!data.success) {

} else {
me.viewCtrl.dismiss();
}

});

}


}
18 changes: 15 additions & 3 deletions src/pages/home/home.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<ion-header>
<ion-navbar>
<ion-toolbar>
<ion-title>Passwords</ion-title>
</ion-navbar>
<ion-buttons end>
<button (click)="addPass()" ion-button icon-only color="royal">
<ion-icon name="add"></ion-icon>
</button>
</ion-buttons>
</ion-toolbar>
</ion-header>

<ion-content padding>
Expand All @@ -15,7 +20,14 @@
<ion-card-content>
<p>{{current.description || "None"}}</p>
<br />
<button ion-button (click)="showPass(current.password_id, current)">Show Password</button>
<ion-buttons start>
<button (click)="showPass(current.password_id, current)" ion-button icon-only>
<ion-icon name="eye"></ion-icon>
</button>
<button (click)="more(current)" ion-button icon-only color="transparent">
<ion-icon name="add"></ion-icon>
</button>
</ion-buttons>
</ion-card-content>

</ion-card>
Expand Down
Loading

0 comments on commit b6d3b59

Please sign in to comment.