From 54272dc5cce827a57482d0ce9c24ee31a8bf78d3 Mon Sep 17 00:00:00 2001 From: Difrex Date: Fri, 13 May 2016 12:46:48 +0300 Subject: [PATCH] Show username in pm -s -n --- Database.pm | 3 ++- Password.pm | 4 ++-- pm.pl | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Database.pm b/Database.pm index 0909711..771933d 100644 --- a/Database.pm +++ b/Database.pm @@ -123,13 +123,14 @@ sub mdo { my $sth = $dbh->prepare($q); $sth->execute(); - my ( $id, $name, $resource, $password ) = $sth->fetchrow_array(); + my ( $id, $name, $resource, $password, $username ) = $sth->fetchrow_array(); my $q_hash = { id => $id, name => $name, resource => $resource, password => $password, + username => $username }; return $q_hash; } diff --git a/Password.pm b/Password.pm index 7fe42e1..9d79852 100644 --- a/Password.pm +++ b/Password.pm @@ -39,7 +39,7 @@ sub show { # Query my $query_string; if ( defined($username) and !($g)) { - $query_string = "select id, name, resource, password from passwords + $query_string = "select id, name, resource, password, username from passwords where name='$name' and username='$username'"; } # Fasthack @@ -48,7 +48,7 @@ sub show { } else { $query_string - = "select id, name, resource, password from passwords where name='$name'"; + = "select id, name, resource, password, username from passwords where name='$name'"; } my $mdo_q; diff --git a/pm.pl b/pm.pl index df763ed..43b207b 100755 --- a/pm.pl +++ b/pm.pl @@ -54,8 +54,10 @@ if ( defined($opt_s) and defined($opt_n) and !defined($opt_o) ) { $copy->copy($get_pass); print colored( "Password copied to xclipboard.", 'green' ); - print "\nURI is "; + print "\nURI: "; print colored( $get_h->{resource} . "\n", 'bold blue' ); + print "User: "; + print colored( $get_h->{username} . "\n", 'bold yellow'); } else { print colored( "Warning! Password will show to terminal!", 'red' ); @@ -160,4 +162,4 @@ elsif ( defined($opt_b) ) { } else { $usage->show(); -} \ No newline at end of file +}