Show all names and uri's
This commit is contained in:
parent
0c984eec91
commit
287ac09440
17
Database.pm
17
Database.pm
@ -41,8 +41,25 @@ sub mdo {
|
||||
|
||||
# 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);
|
||||
$sth->execute();
|
||||
|
||||
my ( $name, $resource, $password ) = $sth->fetchrow_array();
|
||||
|
||||
my $q_hash = {
|
||||
|
@ -62,7 +62,7 @@ sub save {
|
||||
my $resource = $store->{resource};
|
||||
my $password = $store->{password};
|
||||
my $generate = $store->{gen};
|
||||
# my $username = $store->{username};
|
||||
my $username = defined($store->{username}) ? '' : '';
|
||||
|
||||
if ( $generate == 1 ) {
|
||||
$password = Password->generate();
|
||||
@ -71,8 +71,8 @@ sub save {
|
||||
# Decrypt database
|
||||
my $dec_db_file = $gpg->decrypt_db();
|
||||
my $q
|
||||
= "insert into passwords(name, resource, password)
|
||||
values('$name', '$resource', '$password')";
|
||||
= "insert into passwords(name, resource, password, username)
|
||||
values('$name', '$resource', '$password', '$username')";
|
||||
my $mdo_q = {
|
||||
file => $dec_db_file,
|
||||
name => $name,
|
||||
|
Loading…
Reference in New Issue
Block a user