diff --git a/package.json b/package.json index eac07b2..6806326 100644 --- a/package.json +++ b/package.json @@ -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" - ] - } -} \ No newline at end of file + "platforms": [ + "android", + "ios" + ] + } +} diff --git a/src/app/Passy.ts b/src/app/Passy.ts index 99e4327..10f14d5 100644 --- a/src/app/Passy.ts +++ b/src/app/Passy.ts @@ -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; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 358bbbb..5e93a4f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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 { +} diff --git a/src/pages/edit-password/edit-pass.html b/src/pages/edit-password/edit-pass.html new file mode 100644 index 0000000..3d11dd9 --- /dev/null +++ b/src/pages/edit-password/edit-pass.html @@ -0,0 +1,21 @@ + + + + + Username + + + + + Password + + + + Description + + + +
+ +
+
diff --git a/src/pages/edit-password/edit-pass.ts b/src/pages/edit-password/edit-pass.ts new file mode 100644 index 0000000..76f629b --- /dev/null +++ b/src/pages/edit-password/edit-pass.ts @@ -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(); + } + + }); + + } + + +} diff --git a/src/pages/home/home.html b/src/pages/home/home.html index b8761e7..e10a681 100644 --- a/src/pages/home/home.html +++ b/src/pages/home/home.html @@ -1,7 +1,12 @@ - + Passwords - + + + + @@ -15,7 +20,14 @@

{{current.description || "None"}}


- + + + +
diff --git a/src/pages/home/home.ts b/src/pages/home/home.ts index ecd729e..472db90 100644 --- a/src/pages/home/home.ts +++ b/src/pages/home/home.ts @@ -1,9 +1,10 @@ import { Component } from '@angular/core'; -import {NavController, PopoverController, Tabs} from 'ionic-angular'; +import {ActionSheetController, ModalController, NavController, PopoverController, Tabs} from 'ionic-angular'; import {Http} from "@angular/http"; import {passwords} from "../../app/Passy"; import {passy} from "../../app/app.component"; import {PassShow} from "../pass-show/pass-show"; +import {NewPassPage} from "../new-password/new-pass"; @@ -17,10 +18,50 @@ export class HomePage { return passwords; } - constructor(public popoverCtrl: PopoverController, public navCtrl: NavController, private http: Http) { + constructor(public modalCtrl: ModalController, + public popoverCtrl: PopoverController, + public navCtrl: NavController, + private http: Http, + public actionSheetCtrl: ActionSheetController) { + } + addPass() { + + let popover = this.modalCtrl.create(NewPassPage); + popover.present({ + }); + + } + public more(value) { + + console.log(value); + let actionSheet = this.actionSheetCtrl.create({ + title: 'Edit or achive this password', + buttons: [ + { + text: 'Edit', + handler: () => { + console.log("weo"); + } + },{ + text: 'Delete', + handler: () => { + console.log("weo"); + + } + },{ + text: 'Cancel', + role: 'cancel', + handler: () => { + console.log("weo"); + + } + } + ] + }); + actionSheet.present(); } public showPass(id, password) { diff --git a/src/pages/login/login-page.html b/src/pages/login/login-page.html index 1934352..cf3a9ee 100644 --- a/src/pages/login/login-page.html +++ b/src/pages/login/login-page.html @@ -13,6 +13,6 @@
- +
diff --git a/src/pages/new-password/new-pass.html b/src/pages/new-password/new-pass.html new file mode 100644 index 0000000..60583c4 --- /dev/null +++ b/src/pages/new-password/new-pass.html @@ -0,0 +1,21 @@ + + + + + Username + + + + + Password + + + + Description + + + +
+ +
+
diff --git a/src/pages/new-password/new-pass.ts b/src/pages/new-password/new-pass.ts new file mode 100644 index 0000000..78aed66 --- /dev/null +++ b/src/pages/new-password/new-pass.ts @@ -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: 'new-pass.html' +}) + +export class NewPassPage { + + private username; + private password; + private description; + + constructor(public viewCtrl: ViewController,public http:Http) { + + + + } + newPass() { + + const me = this; + + passy.addPassword(this.http, this.username, this.password, this.description, function (data) { + + if(!data.success) { + + } else { + me.viewCtrl.dismiss(); + } + + }); + + } + + +} diff --git a/src/pages/pass-show/pass-show.html b/src/pages/pass-show/pass-show.html index 3946a99..851c9fd 100644 --- a/src/pages/pass-show/pass-show.html +++ b/src/pages/pass-show/pass-show.html @@ -1,6 +1,11 @@ - - {{password}} - + + + + Password + + + +