Show all names and uri's

This commit is contained in:
Difrex(Denis Zheleztsov) 2014-05-06 15:01:07 +04:00
parent 0c984eec91
commit 287ac09440
3 changed files with 21 additions and 5 deletions

View File

@ -41,8 +41,25 @@ sub mdo {
# Select # Select
if ( $type eq 'select' ) { if ( $type eq 'select' ) {
# Bad hack
if ( $name eq 'all' ) {
my $q = 'select name, resource, username from passwords';
my $sth = $dbh->prepare($q);
my $rv = $sth->execute();
print "\nNAME\tRESOURCE\tUSERNAME\n";
while ( my ( $name, $resource, $username )
= $sth->fetchrow_array() )
{
print "\n$name\t$resource\t$username\n";
}
exit 0;
}
my $sth = $dbh->prepare($q); my $sth = $dbh->prepare($q);
$sth->execute(); $sth->execute();
my ( $name, $resource, $password ) = $sth->fetchrow_array(); my ( $name, $resource, $password ) = $sth->fetchrow_array();
my $q_hash = { my $q_hash = {

View File

@ -62,7 +62,7 @@ sub save {
my $resource = $store->{resource}; my $resource = $store->{resource};
my $password = $store->{password}; my $password = $store->{password};
my $generate = $store->{gen}; my $generate = $store->{gen};
# my $username = $store->{username}; my $username = defined($store->{username}) ? '' : '';
if ( $generate == 1 ) { if ( $generate == 1 ) {
$password = Password->generate(); $password = Password->generate();
@ -71,8 +71,8 @@ sub save {
# Decrypt database # Decrypt database
my $dec_db_file = $gpg->decrypt_db(); my $dec_db_file = $gpg->decrypt_db();
my $q my $q
= "insert into passwords(name, resource, password) = "insert into passwords(name, resource, password, username)
values('$name', '$resource', '$password')"; values('$name', '$resource', '$password', '$username')";
my $mdo_q = { my $mdo_q = {
file => $dec_db_file, file => $dec_db_file,
name => $name, name => $name,

3
pm.pl
View File

@ -61,12 +61,11 @@ sub init() {
my $pass = Password->new(); my $pass = Password->new();
# Don't use it's before GPG and Database
if ( $pass->check_config() == 0 ) { if ( $pass->check_config() == 0 ) {
exit 0; exit 0;
} }
init() if $pass->check_config() == 1; init();
my $copy = ClipPass->new(); my $copy = ClipPass->new();