Show username in pm -s -n

This commit is contained in:
Difrex 2016-05-13 12:46:48 +03:00
parent 4db1e9d6d3
commit 54272dc5cc
3 changed files with 8 additions and 5 deletions

View File

@ -123,13 +123,14 @@ sub mdo {
my $sth = $dbh->prepare($q); my $sth = $dbh->prepare($q);
$sth->execute(); $sth->execute();
my ( $id, $name, $resource, $password ) = $sth->fetchrow_array(); my ( $id, $name, $resource, $password, $username ) = $sth->fetchrow_array();
my $q_hash = { my $q_hash = {
id => $id, id => $id,
name => $name, name => $name,
resource => $resource, resource => $resource,
password => $password, password => $password,
username => $username
}; };
return $q_hash; return $q_hash;
} }

View File

@ -39,7 +39,7 @@ sub show {
# Query # Query
my $query_string; my $query_string;
if ( defined($username) and !($g)) { 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'"; where name='$name' and username='$username'";
} }
# Fasthack # Fasthack
@ -48,7 +48,7 @@ sub show {
} }
else { else {
$query_string $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; my $mdo_q;

4
pm.pl
View File

@ -54,8 +54,10 @@ if ( defined($opt_s) and defined($opt_n) and !defined($opt_o) ) {
$copy->copy($get_pass); $copy->copy($get_pass);
print colored( "Password copied to xclipboard.", 'green' ); print colored( "Password copied to xclipboard.", 'green' );
print "\nURI is "; print "\nURI: ";
print colored( $get_h->{resource} . "\n", 'bold blue' ); print colored( $get_h->{resource} . "\n", 'bold blue' );
print "User: ";
print colored( $get_h->{username} . "\n", 'bold yellow');
} }
else { else {
print colored( "Warning! Password will show to terminal!", 'red' ); print colored( "Warning! Password will show to terminal!", 'red' );