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

Commit

Permalink
Fixed some typos and messages, added a search function for Passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
liz3 committed Sep 6, 2017
1 parent 362f6c8 commit 3134e36
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 118 deletions.
3 changes: 2 additions & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="pw.passy.ionic" version="0.1.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="pw.passy.ionic" version="0.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Passy</name>
<description>The mobile App for the Passy Password Manager</description>
<author email="[email protected]" href="https://passy.pw">Passy Team</author>
Expand Down Expand Up @@ -77,6 +77,7 @@
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
</platform>
<allow-navigation href="http://192.168.178.23:8100" />
<engine name="android" spec="^6.2.3" />
<engine name="ios" spec="^4.4.0" />
<plugin name="cordova-plugin-console" spec="^1.0.7" />
Expand Down
11 changes: 10 additions & 1 deletion src/app/Passy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ import {loginScreen, popAlert} from "../pages/tabs/tabs";
export var passwords = [];
export var archived = [];
export var loggedIn = false;

export function randomPassword(length) {
var alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#-.,+*$%&!",
string = "";
for (var i = 0; i < length; i++) {
var position = Math.floor(Math.random() * alphabet.length);
string += alphabet.charAt(position);
}
return string;
}
export class Passy {

accessToken;
Expand Down Expand Up @@ -252,6 +260,7 @@ export class Passy {
for (let i = 0; i != json.data.length; i++) {
const current = json.data[i];
current.vis = true;
current.totalVis = true;

if (current.archived) {
archive.push(current);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/archived/archive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ArchivePage {

const me = this;
let actionSheet = this.actionSheetCtrl.create({
title: 'Edit or achive this password',
title: 'Restore or delete the password',
buttons: [
{
text: 'Restore',
Expand Down
52 changes: 29 additions & 23 deletions src/pages/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,34 @@

<ion-content padding>

<ion-card *ngFor="let current of passwords">

<ion-card-header>
{{current.username || "None"}}
</ion-card-header>

<ion-card-content>
<p>{{current.description || "None"}}</p>
<br />
<ion-buttons start>
<button *ngIf="current.vis" (click)="showPass(current.password_id, current)" ion-button icon-only>
<ion-icon name="eye"></ion-icon>
</button>
<button *ngIf="!current.vis" ion-button icon-only>
<ion-spinner item-start></ion-spinner>
</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>
<ion-searchbar (ionInput)="search($event)" [(ngModel)]="searchText"></ion-searchbar>

<div *ngFor="let current of passwords">
<ion-card *ngIf="current.totalVis">

<ion-card-header>
{{current.username || "None"}}
</ion-card-header>

<ion-card-content>
<p>{{current.description || "None"}}</p>
<br />
<ion-buttons start>
<button *ngIf="current.vis" (click)="showPass(current.password_id, current)" ion-button icon-only>
<ion-icon name="eye"></ion-icon>
</button>
<button *ngIf="!current.vis" ion-button icon-only>
<ion-spinner item-start></ion-spinner>
</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>
</div>



</ion-content>
195 changes: 115 additions & 80 deletions src/pages/home/home.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import {Component} from '@angular/core';
import {ActionSheetController, ModalController, NavController, PopoverController, Tabs} from 'ionic-angular';
import {Http} from "@angular/http";
import {passwords} from "../../app/Passy";
Expand All @@ -9,95 +9,130 @@ import {EditPassPage} from "../edit-password/edit-pass";
import {Storage} from "@ionic/storage";



@Component({
selector: 'page-home',
templateUrl: 'home.html'
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {

get passwords() {
return passwords;
}

constructor(public modalCtrl: ModalController,
public popoverCtrl: PopoverController,
public navCtrl: NavController,
private http: Http,
public actionSheetCtrl: ActionSheetController, public storage: Storage) {



}
logout() {
this.storage.clear().then(_ => {

passy.logOut();
});
}
addPass() {

let popover = this.modalCtrl.create(NewPassPage);
popover.present({
});

}
public more(value) {

const me = this;
let actionSheet = this.actionSheetCtrl.create({
title: 'Edit or achive this password',
buttons: [
{
text: 'Edit',
handler: () => {
const id = value.password_id;
passy.getPassword(id, this.http, function (password) {
let popover = me.modalCtrl.create(EditPassPage, {
password: {data: value, pass: password}
});
popover.present({
});
});
private searchText = '';

get passwords() {
return passwords;
}

}
},{
text: 'Delete',
handler: () => {
passy.archive(me.http, value.password_id, function (data) {
constructor(public modalCtrl: ModalController,
public popoverCtrl: PopoverController,
public navCtrl: NavController,
private http: Http,
public actionSheetCtrl: ActionSheetController, public storage: Storage) {


})
}
},{
text: 'Cancel',
role: 'cancel',
handler: () => {
}

search(item) {

}
if (this.searchText == "") {

for (let i = 0; i < passwords.length; i++) {
passwords[i].totalVis = !passwords[i].totalVis;
}
return;
}
for (let i = 0; i < passwords.length; i++) {
const current = passwords[i];


if (current.username == null && current.description == null) {
current.totalVis = false;
continue;
}
const description = current.description;
const username = current.username;

if (description != null && description.indexOf(this.searchText) != -1) {
passwords[i].totalVis = true;
continue;
}
if (username != null && username.indexOf(this.searchText) != -1) {
passwords[i].totalVis = true;
continue;
}

passwords[i].totalVis = false;
}
]
});
actionSheet.present();
}
public showPass(id, password) {

const me = this;
password.vis = false;
passy.getPassword(id, this.http, function (pass) {

let popover = me.popoverCtrl.create(PassShow, {
passInf: password,
password: pass
});
password.vis = true;
popover.present({

});
})

}


}

logout() {
this.storage.clear().then(_ => {

passy.logOut();
});
}

addPass() {

let popover = this.modalCtrl.create(NewPassPage);
popover.present({});

}

public more(value) {

const me = this;
let actionSheet = this.actionSheetCtrl.create({
title: 'Edit or achive this password',
buttons: [
{
text: 'Edit',
handler: () => {
const id = value.password_id;
passy.getPassword(id, this.http, function (password) {
let popover = me.modalCtrl.create(EditPassPage, {
password: {data: value, pass: password}
});
popover.present({});
});

}
}, {
text: 'Delete',
handler: () => {
passy.archive(me.http, value.password_id, function (data) {


})
}
}, {
text: 'Cancel',
role: 'cancel',
handler: () => {


}
}
]
});
actionSheet.present();
}

public showPass(id, password) {

const me = this;
password.vis = false;
passy.getPassword(id, this.http, function (pass) {

let popover = me.popoverCtrl.create(PassShow, {
passInf: password,
password: pass
});
password.vis = true;
popover.present({});
})

}


}
19 changes: 7 additions & 12 deletions src/pages/login/LoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Http} from "@angular/http";
import {isCordovaAvailable, Passy} from "../../app/Passy";
import {TouchID} from '@ionic-native/touch-id';
import {Storage} from "@ionic/storage";
import { LoadingController } from 'ionic-angular';
import {LoadingController} from 'ionic-angular';


@Component({
Expand All @@ -19,9 +19,6 @@ export class LoginPage {


constructor(public viewCtrl: ViewController, public http: Http, private touchId: TouchID, public storage: Storage, public alertCtrl: AlertController, public loadingCtrl: LoadingController) {


console.log("called 1")
}


Expand All @@ -30,21 +27,20 @@ export class LoginPage {
stPassy(new Passy(this.target));
const me = this;
let loader = this.loadingCtrl.create({
content: "Login in",
content: "Logging in...",
duration: 60000
});
loader.present();
passy.tryLogin(this.username, this.password, this.http, function (succeeded) {
loader.dismissAll();
if (succeeded) {
if(isCordovaAvailable()) {
if (isCordovaAvailable()) {
me.storage.keys().then(keys => {


if (keys.indexOf("touch_dismiss") == -1) {

let confirm = me.alertCtrl.create({
title: 'Save for touch id?',
title: 'Enable Touch ID Login?',
message: 'Do you want to be able to login with touch id?',
buttons: [{
text: 'Disagree',
Expand Down Expand Up @@ -87,22 +83,21 @@ export class LoginPage {

ionViewDidLoad() {

if (!isCordovaAvailable()) return;

if(!isCordovaAvailable()) return;
console.log("called 2");
const it = this;
this.storage.keys().then(keys => {
if (keys.indexOf("touch_save") != -1) {

it.touchId.isAvailable()
.then(_ => {
it.touchId.verifyFingerprint('Verify the Touch setup')
it.touchId.verifyFingerprint('Login to Passy with Touch ID')
.then(
res => {
it.storage.get("touch_user").then(username => {
it.storage.get("touch_pass").then(pass => {
let loader = it.loadingCtrl.create({
content: "Login in",
content: "Logging in...",
duration: 60000
});
loader.present();
Expand Down
Loading

0 comments on commit 3134e36

Please sign in to comment.